Net.HTTP.Response

lib/Net/HTTP/Response.gob

A response a client received: its status, its header fields, its body, which a client's callback reads as an Incoming, the URL it came from, and how long each part of getting it took.

send(c, request(GET, url), Duration.seconds(10), fun(resp) = match resp.status {
    OK -> receive(resp.body, 65536)
    _ -> ...
})

A record whose constructor is exported, as Request is, since each field's type holds its own invariant: headers holds no field that frames the message, which the client read and took out.

type Response b = Response { status : Net.HTTP.Status.Status, headers : Headers, body : b, url : HTTPURL, timings : Timings }

url is the URL the response came from: the request's, or the last redirect's when the client followed some.

type Timings = Timings { dns : Option Duration, connect : Option Duration, tls : Option Duration, firstByte : Duration }

How long each part of one request took, on the connection its response came over.

  • dns, connect and tls: resolving the host, connecting to it, and the TLS handshake. None for a connection taken from the pool, and tls is None for http.
  • firstByte: from starting to write the request to reading the first byte of its response.
instance HasHeaders (Response b)