package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

Dune Dependency

Authors

Maintainers

Sources

b0-0.0.3.tbz
sha512=d24b09eb520b8b91a1e5715badc9f5bcd6a6ec49c047f719a07afef6b835c128dc63e00c3be73d5353b037f4c3c9f2889e40666b30e297e872e4d011f098394c

doc/b0_b00_kit/B00_http/Http/index.html

Module B00_http.Http

HTTP methods, requests and responses.

HTTP methods and headers

type 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.

val meth_to_string : meth -> string

meth_to_string m is a string representation of m.

type headers = (string * string) list

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

HTTP requests

type req

The type for HTTP requests.

val 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 "").

val req_uri : req -> Uri.t

req_uri r is r's request URI.

val req_meth : req -> meth

req_meth r is r's HTTP method.

val req_headers : req -> headers

req_headers r is r's headers.

val req_body : req -> string

req_body r is r's body.

HTTP responses

type resp

The type for HTTP responses.

val 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 "")

val resp_headers : resp -> headers

resp_headers r are the HTTP response headers.

val resp_status : resp -> int

resp_status r is the HTTP response status.

val resp_body : resp -> string

resp_body r is the HTTP response body.

OCaml

Innovation. Community. Security.