package resto-cohttp

  1. Overview
  2. Docs

Module Resto_cohttp.CorsSource

CORS (cross-origin resource sharing) controls the ways in which resources from different domains are allowed to be obtained.

See the specifications at https://fetch.spec.whatwg.org/#http-cors-protocol

Sourcetype t = {
  1. allowed_headers : string list;
    (*

    https://fetch.spec.whatwg.org/#http-access-control-allow-headers

    *)
  2. allowed_origins : string list;
    (*

    https://fetch.spec.whatwg.org/#http-access-control-allow-origin

    *)
}
Sourceval default : t

default is a t with no allowed headers and no allowed origins.

Sourceval add_allow_origin : Cohttp.Header.t -> t -> string option -> Cohttp.Header.t
Sourceval add_headers : Cohttp.Header.t -> t -> string option -> Cohttp.Header.t
Sourceval check_host : Cohttp.Header.t -> t -> bool

check_host header t is true if one of t's members matches the header's Host field.

OCaml

Innovation. Community. Security.