Module Morph.Response
Defines the response type and helper functions to easily create responses in Morph.
type body=[|`String(string)Use a simple string as body
|`Stream(Lwt_stream.t(char))Use a stream of chars as body
|`StringStream(Lwt_stream.t(string))Use a stream of strings as body
];Response.bodyvariant type structure. There are currently 3 types of bodies.`StringUse a simple string as body`StreamUse a stream of chars as body, the stream will be written fully before flushing`StringStreamUse a stream of strings as body, it will be flushed on every new string
let make: ?status:Status.t => ?headers:headers => body => t;make status headers bodycreates a response.
let empty: t;empty tan empty response, a starting place to compose an http response.
let add_header: (string, string) => t => t;add_header header responsereturns a copy of t of response with the header tuple added.
let add_headers: headers => t => t;add_header headers responsereturns a copy of t of response with the headers added.
let set_status: Status.t => t => t;set_status status responsereturns a copy of t with the given status.
let text: string => t => Lwt.t(t);text text responseis a conventience function to return a text response.
let json: string => t => Lwt.t(t);json json responseis a conventience function to return a JSON response.
let html: string => t => Lwt.t(t);html markup responseis a conventience function to return a HTML response.
let redirect: ?code:int => string => t => Lwt.t(t);redirect code target responseis a conventience function to create a redirect response.
let unauthorized: string => t => Lwt.t(t);unauthorized message responseis a conventience function to return a unauthorized response.
