Conduit v0.8.3 Conduit.ContentType.Text View Source

Handles converting a message body to and from Text.

Link to this section Summary

Functions

Formats the message body to json and sets the content type

Parses the message body from json and sets the content type

Link to this section Functions

Formats the message body to json and sets the content type.

Examples

iex> import Conduit.Message
iex> message =
iex>   %Conduit.Message{}
iex>   |> put_body("my message")
iex>   |> Conduit.ContentType.Text.format([])
iex> message.body
"my message"
iex> message.content_type
"text/plain"

Parses the message body from json and sets the content type.

Examples

iex> import Conduit.Message
iex> message =
iex>   %Conduit.Message{}
iex>   |> put_body("my message")
iex>   |> Conduit.ContentType.Text.parse([])
iex> message.body
"my message"
iex> message.content_type
"text/plain"