On this page:
Response
Response.status_  line
Response.status_  code
Response.status_  message
Response.http_  version
Response.raw_  headers
Response.headers
Response.output
Response.body
Response.history
Response.close
Response.drain
Status  Code
current_  user_  agent
Response.handle
8.16.0.4

3 Responses🔗ℹ

class

class Response():

  expression ~none

  binding 'Response($field, ...)'

 

field

 = 

~status_line: bstr_bind

 | 

~status_code: status_code_bind

 | 

~status_message: bstr_bind

 | 

~http_version: bstr_bind

 | 

~history: response_list_bind

 | 

~headers: { key_str: bstr_bind, ... }

 | 

~headers: { key_str: bstr_bind, ..., & bstr_list_bind }

 | 

~body: bstr_bind

A Response represents a request sent via Session.request or through one of the shorthand functions like get.

A Response may still be in the process of receiving its data when it is returned, so methods like Response.body may block while data is read. A Response is Closeable via Response.close.

As a binding form, Response extracts and sometimes converts response information, blocking as needed until the information is available. The extracted information is matched against a given binding.

Accesses the raw immediate data for a request response.

method

method (resp :: Response).headers() :: Map.of(String, Bytes)

Returns the same result as Response.raw_headers, but parsed into a map from field names to values.

method

method (resp :: Response).output() :: Port.Input

 

method

method (resp :: Response).body() :: Bytes

The Response.output method returns an output port that provides the response’s body content. The Response.body method reads and records all data from that output port; calling Response.body a second time returns the same recorded data.

If Response.output is called after Response.body, then the returned output port will be closed. If ~stream: #false or ~close: #true were provided to Session.request to obtain the Response object, then Response.body is effectively called already.

Reports redirections taken to arrive at the final response. The redirection responses are in reverse order in the result list (i.e., most recent first).

method

method (resp :: Response).close() :: Void

 

method

method (resp :: Response).drain() :: Void

The Response.close method terminates any communication still in process to reeceive the result.

The Response.drain method reads all data for the response body and records it. A Response.drain call has no effect if the content is already read.

annotation

StatusCode

Equivalent to Int.in(100, 999).

Supplies a default value for the ~user_agent argument of Session.request, which determines the User-Agent field of the request.

property

property (resp :: Response).handle

Returns a Racket representation of the response.