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

Show request.body of GET request #1124

Open
ksdputra opened this issue Mar 16, 2023 · 3 comments
Open

Show request.body of GET request #1124

ksdputra opened this issue Mar 16, 2023 · 3 comments

Comments

@ksdputra
Copy link

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.

@brianr
Copy link
Member

brianr commented Mar 16, 2023

GET requests don't have a body, per the HTTP spec. Maybe you are looking for request.params?

@ksdputra
Copy link
Author

I believe it's request.body.

In postman, it looked like this:
Screenshot 2023-03-20 at 08 44 21

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.

@brianr
Copy link
Member

brianr commented Mar 20, 2023

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

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

No branches or pull requests

2 participants