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

Add ability to get request bodies as parameters. Issue #64 #180

Merged
merged 4 commits into from Jun 4, 2012

Conversation

bobbytables
Copy link
Contributor

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.

 - Add spec to make sure body_params does not include parameters defined by the route.
@dblock
Copy link
Member

dblock commented Jun 1, 2012

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.

@bobbytables
Copy link
Contributor Author

@dblock Added documentation.

@bobbytables
Copy link
Contributor Author

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.

@mhenrixon
Copy link

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```
Copy link
Member

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?

@bobbytables
Copy link
Contributor Author

@dblock Do you get a notification for when I update this request? Sorry if you do =P

@dblock
Copy link
Member

dblock commented Jun 4, 2012

Thanks. I'm merging it.

dblock added a commit that referenced this pull request Jun 4, 2012
Add ability to get request bodies as parameters. Issue #64
@dblock dblock merged commit 06310eb into ruby-grape:master Jun 4, 2012
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

Successfully merging this pull request may close these issues.

None yet

3 participants