Make fix for param collision - #38
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses parameter key collisions between Rails routing metadata (controller/action) and JSON payloads that legitimately contain top-level keys named "action" or "controller", ensuring deferred requests preserve both correct routing info and the original payload.
Changes:
- Update
DeferredRequest.from_requestto source the routing action frompath_parametersand to build stored params fromrequest_parameters+query_parameters+ non-routingpath_parameters. - Add focused model and integration tests covering
"action"/"controller"payload preservation, JSON body capture, and form-encoded behavior.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/models/deferred_request/deferred_request.rb | Fixes routing/action extraction and param construction to avoid collisions with payload keys. |
| test/models/deferred_request/deferred_request_test.rb | Adds unit tests and a helper to simulate raw bodies for JSON/form requests. |
| test/controllers/deferred_request/test_controller_test.rb | Adds end-to-end tests validating payload preservation through the full request cycle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # RAW_POST_DATA, so that needs to be set too for non-JSON bodies. | ||
| request.set_header("RAW_POST_DATA", raw_body) | ||
| request.set_header("CONTENT_LENGTH", raw_body.bytesize.to_s) | ||
| request.set_header("rack.input", StringIO.new(raw_body)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.