Encoding primitives for Dream applications.
  • OCaml 89.1%
  • Makefile 8.2%
  • Dune 2.7%
Find a file
2024-11-08 11:19:59 +01:00
.github/workflows Fix CI 2021-07-02 09:48:43 +02:00
example Prepare release 0.2.0 2022-04-09 12:34:43 +02:00
lib Use a sub_log and log at debug level (#2) 2024-11-08 10:55:01 +01:00
.gitignore Initial commit 2021-05-17 18:46:04 +02:00
.ocamlformat Prepare release 0.2.0 2022-04-09 12:34:43 +02:00
CHANGES.md Prepare release 0.3.0 2024-11-08 11:19:59 +01:00
dream-encoding.opam Prepare release 0.2.0 2022-04-09 12:34:43 +02:00
dream-encoding.opam.template Prepare release 0.2.0 2022-04-09 12:34:43 +02:00
dune-project Prepare release 0.2.0 2022-04-09 12:34:43 +02:00
LICENSE Initial commit 2021-05-17 18:46:04 +02:00
Makefile Tweak Makefile 2021-07-02 09:57:39 +02:00
README.md Update documentation link 2021-06-28 12:09:36 +02:00

Dream Encoding

Actions Status

Encoding primitives for Dream.

Usage

The most common usage is to add the Dream_encoding.compress middleware to your Dream application:

let () =
  Dream.run ~debug:true
  @@ Dream.logger
  @@ Dream_encoding.compress
  @@ Dream.router [ Dream.get "/" (fun _ -> Dream.html "Hello World!") ]
  @@ Dream.not_found

The middleware will parse the Accept-Encoding header from the requests and compress the responses accordingly.

The library API also includes other lower-level functions for convenience, and are documented here.

Limitation

As of now, the only supported encoding directives are gzip and deflate.

Support for more compression methods will come when they are supported in decompress, the underlying compression library used in dream-encoding.

To Do