-
-
Notifications
You must be signed in to change notification settings - Fork 120
Add :form and :multipart formats #452
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
Conversation
People will use these values in their app, so it's already effectively in the public API, might as well include it in the API docs.
|
I tried this branch out with my application, and was able to resolve an issue I had where my Hanami apps had to define the |
|
This is an unequivocally good first step towards improving this stuff. Thanks @cllns! Bringing this in as part of our improvements to |
|
@cllns Now that I think about it, and after putting together #485, where it is clear that users can add formats with multiple associated MIME types, I wonder if it would make more sense to group the I'm thinking about the scenario of a user doing To me, "having my actions accept form submissions" feels like a bog basic aspect of "supporting HTML". In this way, I think that users should not have to remember to add If we rejigged this I want to get this stuff right (as much as possible, at least) before we release beta2, so I think I'm going to have a play in a test app and explore this idea, but I wanted to write it here first in case you had any feedback in the meantime :) |
|
Update: I'm taking a slightly different approach. I hope to have some code to share in the next day or two. The approach is based on storing mime types and content types separately for formats, which allows us to do this: html: Format.new(
name: :html,
mime_type: "text/html",
content_types: ["application/x-www-form-urlencoded", "multipart/form-data"]
) |
|
OK, these entries are now removed as of #485. To ensure these content types are accepted for HTML formats, we have the following default format registered: html: Format.new(
name: :html,
media_type: "text/html",
content_types: ["application/x-www-form-urlencoded", "multipart/form-data"]
)What this means is this: if |
These are commonly used for web apps so we should have first-class support for them.
Related: #439
Also, I made
Hanami::Action::Mime::TYPESinto@api public(from private). The values are already used in apps so it's effectively already public API, so we might as well show them in the API docs. We already link to the constant in the guides, so in the future that could be a link to API docs (once those are working properly).