Module Tiny_httpd.Request
type 'body t={meth : Meth.t;host : string;headers : Headers.t;path : string;path_components : string list;query : (string * string) list;body : 'body;}A request with method, path, host, headers, and a body, sent by a client.
The body is polymorphic because the request goes through several transformations. First it has no body, as only the request and headers are read; then it has a stream body; then the body might be entirely read as a string via
read_body_full.- since
- 0.6 The field [query] was added and contains the query parameters in ["?foo=bar,x=y"]
- since
- 0.6 The field [path_components] is the part of the path that precedes [query] and is split on ["/"].
val pp : Stdlib.Format.formatter -> string t -> unitPretty print the request and its body
val pp_ : Stdlib.Format.formatter -> _ t -> unitPretty print the request without its body
val get_header : ?f:(string -> string) -> _ t -> string -> string optionval get_header_int : _ t -> string -> int optionval set_header : 'a t -> string -> string -> 'a tval host : _ t -> stringHost field of the request. It also appears in the headers.
val path : _ t -> stringRequest path.
val body : 'b t -> 'bRequest body, possibly empty.
val limit_body_size : max_size:int -> byte_stream t -> byte_stream tLimit the body size to
max_sizebytes, or return a413error.- since
- 0.3
val read_body_full : byte_stream t -> string tRead the whole body into a string. Potentially blocking.