package ocsigenserver

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Ocsigen_responseSource

Sourcetype t
Sourcemodule Body : sig ... end
Sourceval make : ?body:Body.t -> ?cookies:Ocsigen_cookie_map.t -> Cohttp.Response.t -> t

Make a response from a Cohttp.Response.t. Note that the transfer-encoding header is not taken into account if it is set to chunked, use add_header. This is because Cohttp.Response.make sets this header by default, which interferes with the transfer-encoding carried by the body.

Sourceval respond : ?headers:Cohttp.Header.t -> status:Http.Status.t -> ?body:Body.t -> unit -> t

Like make but with an interface similar to Cohttp_lwt_unix.Server.respond.

Sourceval respond_string : ?headers:Cohttp.Header.t -> status:Http.Status.t -> body:string -> unit -> t

Like respond but with a fixed string body.

Sourceval respond_error : ?headers:Cohttp.Header.t -> ?status:Http.Status.t -> body:string -> unit -> t

Like respond_string with "Error: " appended to the body. The default status is `Internal_server_error.

  • deprecated

    Use respond_string with a ~status argument instead.

Sourceval respond_file : ?headers:Cohttp.Header.t -> ?status:Http.Status.t -> string -> t Lwt.t

Respond with the content of a file. The content type is guessed using Magic_mime.

Sourceval update : ?response:Cohttp.Response.t -> ?body:Body.t -> ?cookies:Ocsigen_cookie_map.t -> t -> t
Sourceval of_cohttp : ?cookies:Ocsigen_cookie_map.t -> (Cohttp.Response.t * Cohttp_lwt.Body.t) -> t
Sourceval to_response_expert : t -> Cohttp.Response.t * ('ic -> Lwt_io.output_channel -> unit Lwt.t)

Response for Cohttp_lwt_unix.Server.make_expert. Set cookie headers.

Sourceval response : t -> Cohttp.Response.t

Raw response without cookie headers set.

Sourceval body : t -> Body.t
Sourceval status : t -> Cohttp.Code.status
Sourceval set_status : t -> Cohttp.Code.status -> t
Sourceval cookies : t -> Ocsigen_cookie_map.t
Sourceval add_cookies : t -> Ocsigen_cookie_map.t -> t
Sourceval header : t -> Ocsigen_header.Name.t -> string option
Sourceval header_multi : t -> Ocsigen_header.Name.t -> string list
Sourceval add_header : t -> Ocsigen_header.Name.t -> string -> t
Sourceval add_header_multi : t -> Ocsigen_header.Name.t -> string list -> t
Sourceval replace_header : t -> Ocsigen_header.Name.t -> string -> t
Sourceval replace_headers : t -> (Ocsigen_header.Name.t * string) list -> t
Sourceval remove_header : t -> Ocsigen_header.Name.t -> t