http

An HTTP request/response parser and serializer for Carp.

Parse requests with Request.parse, responses with Response.parse. Build requests with Request.get, Request.post, etc.

Status codes are available as constants in the Status module. Form bodies can be parsed with Form.parse.

Parsing

(match (Request.parse "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
  (Result.Success req) (println* (Request.verb &req))
  (Result.Error e) (IO.errorln &e))

Status codes

Status.ok           ; => 200
Status.not-found    ; => 404
(Status.reason 200) ; => "OK"