5 Responses
|
method
(send a-response get-request) → request?
Returns the request that generated this response.Note: this request is generally the result of the client’s adjust-request method, so it is not equal to the original request given to the client. Do not rely on request equality.
method
(send a-response get-version) → (or/c 'http/1.1 'http/2)
Returns a symbol identifying version of HTTP used to retrieve the response.Note: Future versions of this library may add more possible results.
method
(send a-response get-status-code) → (integer-in 100 599)
Returns the response’s status code.Note: this library currently discards all Informational (1xx) responses.
method
(send a-response get-status-class) → status-class/c
Returns a symbol describing the status class of the response’s status code.Note: this library currently discards all Informational (1xx) responses.
method
(send a-response get-header) → (is-a?/c header<%>)
method
(send a-response get-header-fields) → (listof header-field/c)
Returns the response’s header as a list of fields.Equivalent to (send (get-header) get-header-fields).
method
(send a-response has-content?) → boolean?
method
(send a-response get-content-in [port-if-no-body?])
→ (or/c #f input-port?) port-if-no-body? : boolean? = #f If the response includes a message body, returns an input port that reads from the message body. If the response does not contain a message body, then if port-if-no-body? is true, returns an empty input port, otherwise returns #f.If the response’s Content-Encoding is either gzip or deflate, the message body is automatically decompressed, and the result input port reads from the uncompressed content.
Reading from the input port may raise an exception reflecting an error reading the response or decompressing the content.
It is not necessary to close the resulting input port.
When using HTTP/2, the following behavior applies to the returned input port:
The unread content in the input port counts against the stream’s flow control window; after a certain amount of data is received, the server will not be allowed to send more until data is consumed from the port.
If the input port is closed before the message body is completely received, the user agent may attempt to cancel the stream to save network traffic and processing.
method
(send a-response get-trailer) → (or/c #f (is-a?/c header<%>))
Returns the response’s trailer, or #f if no trailer exists (for example, if an HTTP/1.1 response did not use chunked transfer encoding).This method blocks until the response has been fully received; see also get-trailer-evt. This method may raise an exception reflecting an error reading the response.
Returns an event that is ready for synchronization when the response has been fully received. The synchronization result is a procedure that returns the trailer if there was one, returns #f if there was no trailer, or raises an exception if there was an error reading the response. See also Synchronizable Event Results.
method
→ (and/c hash? hash-eq? immutable?) (send a-response user-info info) → void? info : (and/c hash? hash-eq? immutable?) Gets or sets the response’s auxiliary info. See handle.
value
= (or/c 'informational 'successful 'redirection 'client-error 'server-error)