You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 params do not contain anything except an id and route_info
env['api.request.body'] is nil
env['api.request.input'] is nil
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! 🐈
The text was updated successfully, but these errors were encountered:
I'll see if I can get it running using rack-multipart_related in my spare time.
For now I have chosen the path of least resistance and use multipart/form-data in the API. I fear that clients will face similar difficulties with their libraries when I would force them to not use multipart/form-data.
Hi,
from reading the docs I could find out that grape basically seems to support multiple
multipart
content types, includingmultipart/related
.However, the relevant section of the documentation just reads:
I see how that is working for
multipart/form-data
and it works beautiful for thatContent-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:
params
do not contain anything except anid
androute_info
env['api.request.body']
isnil
env['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! 🐈
The text was updated successfully, but these errors were encountered: