Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Module for creating and sending responses.
val default : unit -> t
Creates a default response record with empty headers and a 200 status.
Sends response t
with body string
. Adding headers Content-type: application/json
and Connection: close
This function will end the http request/response lifecycle.
Sends response t
with body string
. Adding headers Content-type: text/html
and Connection: close
This function will end the http request/response lifecycle.
Sends response t
with body string
. Adding headers Content-type: text/plain
and Connection: close
This function will end the http request/response lifecycle.
Sends response t
with body string
.
This function will not add any headers other than Connection: close
. This function will end the http request/response lifecycle.
Creates new response from t
with header (string, string)
added.
Opens file starting at path string
and following list(string)
. Sets Content-type
header based on file extension. If type cannot be inferred text/plain
is used. Responds with 404
if file does not exist.
This function will end the http request/response lifecycle.
Sets Location
header to string
and responds with 302
. Redirecting client to string
.
val reportError : 'sessionData Req.t -> exn -> unit
Report an error exn
to Httpaf.