View Source Msgpax.PlugParser (Msgpax v2.4.0)
A Plug.Parsers
plug for parsing a MessagePack-encoded body.
Look at the documentation for
Plug.Parsers
for more
information on how to use Plug.Parsers
.
This parser accepts the :unpacker
option to configure how unpacking should be done.
Its value can either be a module that implements the unpack!/1
function
or a module, function, and arguments tuple. Note, the response
body will be prepended to the given list of arguments before applying.
examples
Examples
defmodule MyPlugPipeline do
use Plug.Builder
plug Plug.Parsers,
parsers: [Msgpax.PlugParser],
pass: ["application/msgpack"]
# Or use the :unpacker option:
plug Plug.Parsers,
parsers: [Msgpax.PlugParser],
pass: ["application/msgpack"],
unpacker: {Msgpax, :unpack!, [[binary: true]]}
# ... rest of the pipeline
end
Link to this section Summary
Functions
Callback implementation for Plug.Parsers.init/1
.
Callback implementation for Plug.Parsers.parse/5
.
Link to this section Functions
Callback implementation for Plug.Parsers.init/1
.
Callback implementation for Plug.Parsers.parse/5
.