-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add ability to get request bodies as parameters. Issue #64 #180
Conversation
- Add spec to make sure body_params does not include parameters defined by the route.
This is great. It needs an update to the README "Parameters" section. Would like to hear if other people think there should be a way to disable this behavior, I would not think so since it's pretty standard with all the content-type and method selection. |
@dblock Added documentation. |
Improved coverage as well, my bad. As for configuration, as of right now there's no real way to "configure" Grape. So I'm not sure where it would go. Probably worth opening another issue for. |
Nice work! This will make Grape more usable in the future since less hacks will be required to make it work of the bat for us coming from a rails background. I see no reason why it should be possible to disable @dblock. |
Parameters are also populated from the request body on POST and PUT for JSON and XML content-types. | ||
|
||
The Request: | ||
```curl -d '{"some_key": "some_value"}' 'http://readercity.com/json_endpoint' -H Content-Type:application/json -v``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-pick. I am sure readercity is a great site - The rest of examples are with localhost:9292
, could you please change this?
@dblock Do you get a notification for when I update this request? Sorry if you do =P |
Thanks. I'm merging it. |
Add ability to get request bodies as parameters. Issue #64
This also gives the ability to pull only parameters out of a request by using the #body_params method. Works for JSON and XML requests.