Created
October 15, 2015 14:54
-
-
Save colinrymer/dbfcf39c9a6540829d08 to your computer and use it in GitHub Desktop.
raw request body plug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Foo.Plugs.CopyReqBody do | |
import Plug.Conn | |
def init(mount: "/" <> mount), do: mount | |
def call(conn = %Plug.Conn{path_info: [mount | _rest]}, mount) do | |
put_private(conn, :req_body, read_body(conn)) | |
end | |
def call(conn, _), do: conn | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment