2008-09-27 12:37:46 -04:00
|
|
|
USING: help.markup help.syntax io.streams.string strings
|
2014-03-28 18:17:06 -04:00
|
|
|
http math furnace.json ;
|
2008-09-27 12:37:46 -04:00
|
|
|
IN: http.server.responses
|
|
|
|
|
|
|
|
HELP: <content>
|
|
|
|
{ $values { "body" "a response body" } { "content-type" string } { "response" response } }
|
|
|
|
{ $description "Creates a successful HTTP response which sends a response body with the specified content type to the client." } ;
|
|
|
|
|
2014-03-28 18:17:06 -04:00
|
|
|
HELP: <text-content>
|
|
|
|
{ $values { "body" "a response body" } { "response" response } }
|
|
|
|
{ $description "Creates a plain text response." } ;
|
|
|
|
|
2008-09-27 12:37:46 -04:00
|
|
|
HELP: <trivial-response>
|
|
|
|
{ $values { "code" integer } { "message" string } { "response" response } }
|
|
|
|
{ $description "Creates an HTTP error response." }
|
|
|
|
{ $examples
|
|
|
|
{ $code
|
|
|
|
"USE: http.server.responses"
|
|
|
|
"415 \"Unsupported Media Type\" <trivial-response>"
|
|
|
|
}
|
|
|
|
} ;
|
|
|
|
|
|
|
|
ARTICLE: "http.server.responses" "Canned HTTP responses"
|
2014-03-28 18:17:06 -04:00
|
|
|
"The " { $vocab-link "http.server.responses" } " vocabulary provides constructors for a few useful " { $link response } " objects." $nl
|
|
|
|
"For successful responses:"
|
2009-10-01 15:56:36 -04:00
|
|
|
{ $subsections
|
|
|
|
<content>
|
2014-03-28 18:17:06 -04:00
|
|
|
<text-content>
|
|
|
|
}
|
|
|
|
|
|
|
|
{ $vocab-link "furnace.json" } " implements " { $link <json-content> } "." $nl
|
|
|
|
"For errors:"
|
|
|
|
{ $subsections
|
2009-10-01 15:56:36 -04:00
|
|
|
<304>
|
|
|
|
<403>
|
|
|
|
<400>
|
|
|
|
<404>
|
|
|
|
}
|
2008-09-27 12:37:46 -04:00
|
|
|
"New error responses like the above can be created for other error codes too:"
|
2009-10-01 15:56:36 -04:00
|
|
|
{ $subsections <trivial-response> } ;
|
2008-09-27 12:37:46 -04:00
|
|
|
|
|
|
|
ABOUT: "http.server.responses"
|