Fix json params parsing regression for non-object JSON content. #8855

Merged
merged 1 commit into from Jan 11, 2013

Projects

None yet

3 participants

@dylanahsmith

Fixes #8845.

request.deep_munge requires a Hash to be passed to it, and the params_parser already wraps non-Hash objects, so it makes sense to just call deep_munge after wrapping the non-Hash object.

@jeremy
Ruby on Rails member

Looks good. We'll need a CHANGELOG entry and a backport to 3-2-stable as well. Thanks!

@dylanahsmith dylanahsmith added a commit to dylanahsmith/rails that referenced this pull request Jan 11, 2013
@dylanahsmith dylanahsmith Fix JSON params parsing regression for non-object JSON content.
Backports #8855.
7003b36
@dylanahsmith

@jeremy added changelog and backport to 3-2-stable.

@dylanahsmith dylanahsmith added a commit to dylanahsmith/rails that referenced this pull request Jan 11, 2013
@dylanahsmith dylanahsmith Fix JSON params parsing regression for non-object JSON content.
Backports #8855.
c669a9c
@jeremy
Ruby on Rails member

Thanks @dylanahsmith. Last thing: could you squash to a single commit and force-push? Clean git history 👍

@dylanahsmith dylanahsmith added a commit to dylanahsmith/rails that referenced this pull request Jan 11, 2013
@dylanahsmith dylanahsmith Fix JSON params parsing regression for non-object JSON content.
Backports #8855.
eede4ab
@jeremy
Ruby on Rails member

:metal:

@jeremy jeremy merged commit 92fada9 into rails:master Jan 11, 2013
@smathieu

I think you need to add

request.body.rewind if request.body.respond_to?(:rewind)

since ActiveSupport::JSON.decode is going to call request.body.read (at least when using unicorn). If you do not, accessing request.body.read from a controller action will return an empty string.

@imanel imanel referenced this pull request Dec 4, 2013
Closed

Remove deep munge #13157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment