package dream-encoding

  1. Overview
  2. Docs
Encoding primitives for Dream

Install

Dune Dependency

Authors

Maintainers

Sources

dream-encoding-0.2.0.tbz
sha256=ca6c5d4a2dd31e1cca75f4ce9c95134b7f339ff2f4ea56d88ea859d57b82aa06
sha512=589eef320af6093100491ad86b318c0667a0bb594144630b80a0f2ba3c1f12d7c9655a30c41d8fffd6200baeb9c33289c6405d7bd887473fad76feb5458f09e9

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.