rollbar-gem
rollbar-gem copied to clipboard
Show request.body of GET request
Hey,
Is there a way to show request.body for GET requests unless put the params in extra? Have read the documentation, googling, and even ask chatGPT, but no luck. Maybe I didn't pay too much attention, but please guide me.
GET requests don't have a body, per the HTTP spec. Maybe you are looking for request.params?
I believe it's request.body.
In postman, it looked like this:

The curl is:
curl --location --request GET 'localhost:3300/partner/check-status' \
--header 'Content-Type: application/json' \
--data '{
"mto_name": "mastercard",
"external_id": "93618bea-9cb7-42f1-b379-87e75fa67d63"
}'
I know this is not the best practice, but I am working on legacy code.
So, is there a built-in way to put the request.body of GET request to the payload other than putting in extra?
As an integration engineer who integrates with more than 30 companies, I found many companies that put request.body in GET request. I agree it's not the best practice, but many people still do it.
Huh, TIL!
So you want the request body to appear in the Rollbar UI when an error occurs during a GET request - is that correct?
The relevant part of the rollbar-gem code is: https://github.com/rollbar/rollbar-gem/blob/master/lib/rollbar/request_data_extractor.rb#L31-L64