Conduit v0.2.1 Conduit.Plug.Decode

Decodes the message body based on the content encoding.

It uses in order of preference:

  1. The content encoding specified for the plug.
  2. The content encoding specified on the message.
  3. The default content encoding identity.

This plug should be used in an incoming pipeline. Generally before a Conduit.Plug.Parse plug.

plug Conduit.Plug.Decode
plug Conduit.Plug.Decode, content_encoding: "gzip"

Summary

Functions

Formats the message body based on the content encoding

Callback implementation for Conduit.Plug.init/1

Functions

call(message, opts)

Formats the message body based on the content encoding.

Examples

iex> import Conduit.Message
iex> message =
iex>   %Conduit.Message{}
iex>   |> put_body("{}")
iex>   |> Conduit.Plug.Decode.call([])
iex> message.body
"{}"
iex> get_meta(message, :content_encoding)
"identity"
init(opts)

Callback implementation for Conduit.Plug.init/1.