Module B00_http.HttpSource

HTTP methods, requests and responses.

HTTP methods and headers

Sourcetype meth = [
  1. | `CONNECT
  2. | `DELETE
  3. | `GET
  4. | `HEAD
  5. | `OPTIONS
  6. | `Other of string
  7. | `PATCH
  8. | `POST
  9. | `PUT
  10. | `TRACE
]

The type for HTTP methods.

Sourceval meth_to_string : meth -> string

meth_to_string m is a string representation of m.

Sourcetype headers = (string * string) list

The type for HTTP headers. List of header names (without the :) tupled with their value.

HTTP requests

Sourcetype req

The type for HTTP requests.

Sourceval req : ?headers:headers -> ?body:string -> uri:string -> meth -> req

req uri m ~headers ~body is a request on uri with method m, headers headers (defaults to []) and body body (defaults to "").

Sourceval req_uri : req -> Uri.t

req_uri r is r's request URI.

Sourceval req_meth : req -> meth

req_meth r is r's HTTP method.

Sourceval req_headers : req -> headers

req_headers r is r's headers.

Sourceval req_body : req -> string

req_body r is r's body.

HTTP responses

Sourcetype resp

The type for HTTP responses.

Sourceval resp : ?headers:headers -> ?body:string -> int -> resp

resp status ~headers ~body is a response with status status, headers headers (defaults to []) and body body (defaults to "")

Sourceval resp_headers : resp -> headers

resp_headers r are the HTTP response headers.

Sourceval resp_status : resp -> int

resp_status r is the HTTP response status.

Sourceval resp_body : resp -> string

resp_body r is the HTTP response body.