Clova v0.5.0 Clova.EncoderPlug View Source
Encodes the data contained in the :clova_response
assign to JSON, sets it as the response body,
and sets the content-type header. The response status is also set to 200
if it has not already been set.
This means your endpoint can simply call Plug.Conn.send_resp/1
with the conn
argument.
plug Plug.Parsers,
parsers: [:json],
json_decoder: Poison,
body_reader: Clova.CachingBodyReader.spec()
plug Clova.ValidatorPlug, app_id: "com.example.my_extension"
plug Clova.DispatcherPlug, dispatch_to: MyExtension
plug Clova.EncoderPlug, json_encoder: Poison
plug :match
plug :dispatch
post "/endpoint" do
send_resp(conn)
end
Link to this section Summary
Link to this section Functions
Callback implementation for Plug.call/2
.
Callback implementation for Plug.init/1
.