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

HTTP GET request with parameters in body and Content-Type header #2282

Open
khiav223577 opened this issue Oct 4, 2022 · 1 comment
Open

Comments

@khiav223577
Copy link

We're trying to replace our custom json-parser middleware in our project with grape formatter middleware recently,
and found that if we send a GET request with parameters in body and with application/json Content-Type, parameters will disappear.

It looks like grape doesn't accept this kind of request

def read_body_input
return unless
(request.post? || request.put? || request.patch? || request.delete?) &&
(!request.form_data? || !request.media_type) &&

I'm not sure if setting Content-Type HTTP header in GET request is a good practice or not.
Could grape support this just like it do for DELETE in #448? Or add this kind of support into config, so that we can do our own configuration?

@dblock
Copy link
Member

dblock commented Oct 5, 2022

Do the RFCs say that you can/cannot have a body on a GET with a content-type? I imagine we'd want to stick to whatever that says.

I don't see a problem parsing a body on a GET, but this is a pretty major breaking change, so it would need to be done carefully, major version upgrade & al. Something configurable (list of methods allowing a body?) may be a good way to start.

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