Endpoints expecting `multipart/related`?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
Hi,
from reading the docs I could find out that grape basically seems to support multiple multipart content types, including multipart/related.
However, the relevant section of the documentation just reads:
Multipart POSTs and PUTs are supported as well.
The request:
curl --form image_file='@image.jpg;type=image/jpg' http://localhost:9292/uploadThe Grape endpoint:
post "upload" do # file in params[:image_file] end
I see how that is working for multipart/form-data and it works beautiful for that Content-Type.
However, at the moment I am not sure if that is the right thing to do for an API that is free of classical HTML forms. That is why I thought about using multipart/related instead, expecting a first part with some metadata and a second part with the actual contents of the file (which is btw. the same thing Google Drive does).
However, it is not yet clear to me how that would be possible using grape. When receiving such a request:
- the
paramsdo not contain anything except anidandroute_info env['api.request.body']isnilenv['api.request.input']isnil
Thus I don't see which options I would have to implement such an endpoint using Grape.
Is this a known/intended limitation?
Am I doing it wrong?
Any help is apprechiated.
Best regards and thanks for taking the time to review this issue! 🐈
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the documented multipart POST and PUT behavior, then inspect the endpoint handling described in the issue, including params, env['api.request.body'], and env['api.request.input']. Compare the multipart/form-data example with the reported multipart/related request containing metadata and file parts. Done means establishing whether multipart/related is supported or documenting the intended limitation and available integration path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100