package dream-encoding

  1. Overview
  2. Docs
Encoding primitives for Dream

Install

Dune Dependency

Authors

Maintainers

Sources

dream-encoding-0.3.0.tbz
sha256=5778442d5d1e2cede3657151242fd2aac12176546fb76fc4d0a5181bd32605ef
sha512=085dfc2cd97ecb1cf94b84431639de3e394b315f728bac20590d22e4ce42be9536957dae641ad758d8637582f9853e4d5bfa1857620af596372bf172b6fe842a

README.md.html

Dream Encoding

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

  • [ ] Support Brotli compression (see https://github.com/mirage/decompress/issues/101)

OCaml

Innovation. Community. Security.