type response_action = [
A request handler can respond in two ways:
`Response, with a
`Expert, with a
Response.tand an IO function that is expected to write the response body. The IO function has access to the underlying
IO.oc, which allows writing a response body more efficiently, stream a response or to switch protocols entirely (e.g. websockets). Processing of pipelined requests continue after the
unitLwt.t is resolved. The connection can be closed by closing the
val resolve_local_file : docroot:string -> uri:Uri.t -> string
Resolve a URI and a docroot into a concrete local filename.
Deprecated. Please use Cohttp.Path.resolve_local_file.
val respond : ?headers:Cohttp.Header.t -> ?flush:bool -> status:Cohttp.Code.status_code -> body:Body.t -> unit -> (Cohttp.Response.t * Body.t) Lwt.t
respond ?headers ?flush ~status ~body will respond to an HTTP request with the given
status code and response
flush is true, then every response chunk will be flushed to the network rather than being buffered.
flush is true by default. The transfer encoding will be detected from the
body value and set to chunked encoding if it cannot be determined immediately. You can override the encoding by supplying an appropriate
Transfer-encoding in the