Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Naboris.ResModule for creating and sending responses.
val default : unit -> tCreates a default response record with empty headers and a 200 status.
Sends response t with body string. Adding headers Content-type: application/json and Content-length
This function will end the http request/response lifecycle.
Sends response t with body string. Adding headers Content-type: text/html and Content-length
This function will end the http request/response lifecycle.
Sends response t with body string. Adding headers Content-type: text/plain and Content-length
This function will end the http request/response lifecycle.
Sends response t with body string.
This function will add Content-length header with the length of string. This function will add Connection: keep-alive header. This function will end the http request/response lifecycle.
val writeChannel : 'a Req.t -> t -> Lwt_io.output Lwt_io.channel * t Lwt.tCreates a Lwt_io.channel(Output) which can be written to to stream data to the client. And a Lwt.t(t) promise, which will resolve when the output channel is closed. This will set Transfer-Encoding: chunked header and follow the protocol for chunked responses.
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. Sets Content-length header with the size of the file in bytes. 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.
Report an error exn by executing error_handler from your Naboris.ServerConfig. Final response code is always 500.
This function will create a new Res and any headers on the current Res will be lost.