Current section
Files
Jump to
Current section
Files
lib/plugs/fetch_request_body.ex
defmodule Kandis.Plugs.FetchRequestBody do
@behaviour Plug
def init(opts) do
opts
end
def call(conn, opts) do
{:ok, body, conn} = Plug.Conn.read_body(conn, opts)
body |> Kandis.KdHelpers.log("KANDIS READBODY", :info)
conn |> Plug.Conn.put_private(:raw_body, body)
end
def read_cached_body(conn) do
conn.private[:raw_body]
end
end