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

Fix for #body_params causing undefined method `size' #210

Merged
merged 2 commits into from
Jul 23, 2012

Conversation

adamgotterer
Copy link
Contributor

An addition in #205 which adds a request.body.size call started causing a 'NoMethodError' exception during "real" non test POST/PUT requests. This error could not be reproduced in a test environment because of the way rack/test wraps request information. During a real life request the request.body type is a Rack::Lint::InputWrapper object. But during a mock scenario a StringIO object. This subtle difference makes it difficult (if not impossible) to reproduce in a test environment without forcing the env to use the InputWrapper object. Changing request.body.size to request.content_length eliminates the exception and serves the same purpose.

This pull request also cleans up a related duplicate test found in the endpoint spec.

dblock added a commit that referenced this pull request Jul 23, 2012
Fix for #body_params causing undefined method `size'
@dblock dblock merged commit 261b40d into ruby-grape:master Jul 23, 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.

2 participants