Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation on how to fetch request body data #31

Open
E14 opened this issue Feb 9, 2018 · 1 comment
Open

Documentation on how to fetch request body data #31

E14 opened this issue Feb 9, 2018 · 1 comment

Comments

@E14
Copy link

E14 commented Feb 9, 2018

Documentation on the intended way on how to fetch the request body data for PUT/POST/... requests is missing.

put "/" do
    IO.puts(inspect(conn.body_params))
    ""
end

# Prints:
# %Plug.Conn.Unfetched{aspect: :body_params}
@E14
Copy link
Author

E14 commented Feb 22, 2018

I found out in the meantime - you're supposed to do this through the config:

eg.

config :trot, :pre_routing, [   
        # other plugs...
	"Elixir.Plug.Parsers": [parsers: [:json], json_decoder: Poison],
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant