2.5 HTTP Responses
"private/response-structs.ss" provides structures and functions related to HTTP responses.
| |||||
code : number? | |||||
message : string? | |||||
seconds : number? | |||||
mime : bytes? | |||||
A basic HTTP response containing no body. code is the response code, message the message, seconds the generation time, mime the MIME type of the file, and extras are the extra headers, in addition to those produced by the server.
| |||||
As with response/basic, except with body as the response body.
| |||||
generator : ((() (listof (or/c bytes? string?)) . ->* . any) . -> . any) |
As with response/basic, except with generator as a function that is called to generate the response body, by being given an output-response function that outputs the content it is called with.
v : any/c |
Checks if v is a valid response. A response is either:
A response/basic structure.
A value matching the contract (cons/c (or/c bytes? string?) (listof (or/c bytes? string?))).
A value matching xexpr?.
Equivalent to #"text/html; charset=utf-8".
Warning:If you include a Content-Length header in a response that is inaccurate, there WILL be an error in transmission that the server will not catch.