package dream-accept

All checked builds pass
  1. Overview
  2. Docs
Accept headers parsing for Dream

Install

dune-project
 Dependency

Authors

Maintainers

Sources

dream-accept-0.1.0.tbz
sha256=79634bbf78fb90f70c54c9a5903b897b84d837281dd6e90f26db6e3123057010
sha512=13e4dc9e823e5d16c63bbb9afc14e1832e66de9b354d7608540e65ff8cb4297bd88862d13f64dfad6eebd21b9969f02ebf381c972cb43c44932822cf8dce50b6

Description

Accept headers parsing for Dream.

Added to opam-repository:

README

Dream Accept

Actions Status

Accept headers parsing for Dream.

Usage

Here is an example of a Dream application that reads the accepted media types and the accepted languages, and generates an HTML pages with the values.

let () =
  Dream.run
  @@ Dream.logger
  @@ Dream.router
       [ Dream.get "/" (fun req ->
             let media_type =
               match Dream_accept.accepted_media_types req |> List.hd with
               | Dream_accept.Media_type (s, sub) ->
                 Printf.sprintf "%s/%s" s sub
               | Dream_accept.Any_media_subtype s ->
                 s
               | Dream_accept.Any ->
                 "*"
             in
             let language =
               match Dream_accept.accepted_languages req |> List.hd with
               | Dream_accept.Language s ->
                 s
               | Dream_accept.Any ->
                 "*"
             in
             Dream.html
               (Printf.sprintf
                  "Media type: %s<br>Language: %s"
                  media_type
                  language))
       ]

Dependencies (3)

  1. dream >= "1.0.0~alpha3"
  2. ocaml >= "4.08.0"
  3. dune >= "2.9"

Dev Dependencies (1)

  1. odoc with-doc

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building dream-accept with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.1.0 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure