Std.Http.Response
Response
Section titled “Response”type Response(status: Int, headers: List[(String, String)], body: String)A response. The headers of a response received by send have lower-case names sorted by name;
values of the same name are joined with , , except that each set-cookie is its own pair. An
HTTP service sends the headers in the written order.
status: Intheaders: List[(String, String)]body: String
UnexpectedStatus
Section titled “UnexpectedStatus”error UnexpectedStatus(status: Int, body: String)The status is not 2xx (require_ok).
status: Intbody: String
fn new(status: Int, body: String) -> ResponseA response with no headers.
add_header
Section titled “add_header”fn add_header(res: Response, name: String, value: String) -> ResponseAdds a header after the ones already in res.
header
Section titled “header”fn header(res: Response, name: String) -> Option[String]The first value of the header name, compared without case.
header_values
Section titled “header_values”fn header_values(res: Response, name: String) -> List[String]All values of the header name in order, compared without case. Not named headers, the
field (E3109).
require_ok
Section titled “require_ok”fn require_ok(res: Response) -> Response fails UnexpectedStatusres if its status is 2xx, otherwise fails with UnexpectedStatus.