bugsnag / bugsnag-ruby

BugSnag error monitoring & reporting software for rails, sinatra, rack and ruby
https://docs.bugsnag.com/platforms/ruby
MIT License
246 stars 174 forks source link

Add any successfully parsed non-nil JSON body to report, regardless of class #795

Open bethesque opened 10 months ago

bethesque commented 10 months ago

Goal

The purpose of this PR is to allow any successfully parsed JSON body to be displayed in the request tab of the event page. Previously, only Hashes were included in the event report, which meant that any errors that occurred during the processing of a request with content type application/json-patch+json (where the top level element is an array) did not have enough information to debug the issue.

Design

N/A

Changeset

Before this change, only JSON that was parsed to a non-empty Hash was added to the $request.body event metadata. After this change, any successfully parsed non-nil object will be added.

Testing

I have not updated the tests, as

Having said that, if it is requested, I will add a new test - it would probably be a unit test that did a naughty test of the private add_request_body method only.

clr182 commented 10 months ago

Hi @bethesque

Thank you for submitting this PR, we will review this when priorities allow.