Response
is a response data type. It holds the code of the request, the
version, the message, the cookies, the headers, and the body.
client-error?
(λ [(Ref Response a)] Bool)
(client-error? r)
checks whether the status code is between 400 and 500.
cookies
(λ [(Ref Response a)] (Ref (Array Cookie) a))
gets the cookies property of a Response.
headers
(λ [(Ref Response a)] (Ref (Map String (Array String)) a))
gets the headers property of a Response.
init
(λ [Int, String, String, (Array Cookie), (Map String (Array String)), String] Response)
creates a Response.
parse
(λ [(Ref String a)] (Result Response String))
(parse txt)
parses a HTTP response from a string txt.
Returns a (Error String) holding the error message if it fails, otherwise
it will return a (Success Response).
server-error?
(λ [(Ref Response a)] Bool)
(server-error? r)
checks whether the status code is between 500 and 600.
set-body!
(λ [(Ref Response a), String] ())
sets the body property of a Response in place.
set-cookies
(λ [Response, (Array Cookie)] Response)
sets the cookies property of a Response.
set-cookies!
(λ [(Ref Response a), (Array Cookie)] ())
sets the cookies property of a Response in place.
set-headers
(λ [Response, (Map String (Array String))] Response)
sets the headers property of a Response.
set-headers!
(λ [(Ref Response a), (Map String (Array String))] ())
sets the headers property of a Response in place.
set-message!
(λ [(Ref Response a), String] ())
sets the message property of a Response in place.
set-version!
(λ [(Ref Response a), String] ())
sets the version property of a Response in place.
str
(λ [(Ref Response a)] String)
(str r)
stringifies the request. It should be stringified exactly as it looks on the wire.
update-body
(λ [Response, (Ref (λ [String] String a) b)] Response)
updates the body property of a Response using a function f.
update-code
(λ [Response, (Ref (λ [Int] Int a) b)] Response)
updates the code property of a Response using a function f.
update-cookies
(λ [Response, (Ref (λ [(Array Cookie)] (Array Cookie) a) b)] Response)
updates the cookies property of a Response using a function f.
update-headers
(λ [Response, (Ref (λ [(Map String (Array String))] (Map String (Array String)) a) b)] Response)
updates the headers property of a Response using a function f.
update-message
(λ [Response, (Ref (λ [String] String a) b)] Response)
updates the message property of a Response using a function f.
update-version
(λ [Response, (Ref (λ [String] String a) b)] Response)
updates the version property of a Response using a function f.