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
I'm trying to contribute to the rspec-openapi library and I'm using hanami 2 in production. In rspec-openapi, there is a dummy test application on rails that I am trying to re-implementon hanami.
In particular, the original application in some cases transmits data in the following formats: application/x-www-form-urlencoded and multipart/form-data when upload images.
@AlexeyMatskevich Thanks for reporting this issue. I've opened a PR adding :form and :multipart as built-in formats, which will be very helpful.
I think your "workaround" above is actually the solution to this problem. The config formats are the highest level and you were manually overriding them lower down the stack in your actions, so they weren't being respected. Does that sound correct?
@cllns Yeah, that sounds about right! For me, this problem comes down to this example - “If I have a basic API application and I define format :json in the Action class - then I can't override the format in subclasses when I need to use multipart or form mimetype in one or two places, simply because that mimetype doesn't exist”.
I'm trying to contribute to the rspec-openapi library and I'm using hanami 2 in production. In rspec-openapi, there is a dummy test application on rails that I am trying to re-implementon hanami.
In particular, the original application in some cases transmits data in the following formats:
application/x-www-form-urlencoded
andmultipart/form-data
when upload images.I'm reading this article https://guides.hanamirb.org/v2.1/actions/formats-and-mime-types/ and I'm following this link over 50 of the most common MIME types and I can't find the MIME-type I need in the list.
By default I'm using form :json, so I'm trying to get around the problem manually:
But I only succeed with form data.
I researched
Hanami::Action::Mime.accepted_mime_type?
i get
I also found this code for FormParser but couldn't find any documentation for it and have no idea how to use it.
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: