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

Add body and headers to request.active_resource #413

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seanpdoyle
Copy link

Closes #391

Expand the data broadcast by the request.active_resource Active Support Notification instrumentation event.

For GET and OPTION requests, omit the :body value from the payload. For all other requests, include the :body.

Closes rails#391

Expand the data broadcast by the `request.active_resource` Active
Support Notification instrumentation event.

For `GET` and `OPTION` requests, omit the `:body` value from the
payload. For all other requests, include the `:body`.
@seanpdoyle seanpdoyle force-pushed the notification-payload branch from c8bb71c to 10204e9 Compare January 5, 2025 03:51
assert_equal "http://37s.sunrise.i:3000/people.json?name=Matz", payload[:request_uri]
assert_equal({ "Accept" => "application/json" }, payload[:headers])
assert_nil payload[:body]
assert_kind_of ActiveResource::Response, payload[:result]
Copy link
Author

Choose a reason for hiding this comment

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

This assertion is a quirk of how ActiveResource::HttpMock.respond_to works. In reality, the payload[:result] kind is a Net::HTTPResponse, but in the test harness it's an ActiveResource::Response.

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.

1 participant