Conduit v0.2.1 Conduit.Plug.Parse
Parses the message body based on the content type.
It uses in order of preference:
- The content type specified for the plug.
- The content type specified on the message.
- The default content type
application/json
.
This plug should be used in an incoming pipeline.
plug Conduit.Plug.Parse
plug Conduit.Plug.Parse, content_type: "application/xml"
Summary
Functions
Formats the message body based on the content type
Callback implementation for Conduit.Plug.init/1
Functions
Formats the message body based on the content type.
Examples
iex> import Conduit.Message
iex> message =
iex> %Conduit.Message{}
iex> |> put_body("{}")
iex> |> Conduit.Plug.Parse.call([])
iex> message.body
%{}
iex> get_meta(message, :content_type)
"application/json"
Callback implementation for Conduit.Plug.init/1
.