Skip to content

Make fix for param collision - #38

Merged
armiiller merged 2 commits into
mainfrom
fix/action-controller-param-collision
Jul 31, 2026
Merged

Make fix for param collision#38
armiiller merged 2 commits into
mainfrom
fix/action-controller-param-collision

Conversation

@armiiller

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_request to source the routing action from path_parameters and to build stored params from request_parameters + query_parameters + non-routing path_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))
@armiiller
armiiller merged commit aa530f3 into main Jul 31, 2026
1 check passed
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