Skip to content

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

Merged
dblock merged 2 commits intoruby-grape:masterfrom
adamgotterer:master
Jul 23, 2012
Merged

Fix for #body_params causing undefined method `size'#210
dblock merged 2 commits intoruby-grape:masterfrom
adamgotterer:master

Conversation

@adamgotterer
Copy link
Copy Markdown
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