ruby-grape / ruby-grape/grape

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

Open
#2,282 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

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
https://github.com/ruby-grape/grape/blob/f5d9831bac2e2dd439d0f3901797995a91139690/lib/grape/middleware/formatter.rb#L78-L81

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 https://github.com/ruby-grape/grape/pull/448? Or add this kind of support into config, so that we can do our own configuration?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/grape/middleware/formatter.rb at the referenced lines and compare its GET handling with the DELETE support discussed in pull request #448. Determine whether the expected behavior is unconditional support or a configuration option, then verify that JSON parameters in a GET request with a Content-Type header are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.