Skip to content
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

Support for extracting named parameters from multipart/form-data #312

Closed
arnholm opened this issue Jan 4, 2022 · 2 comments · Fixed by #358
Closed

Support for extracting named parameters from multipart/form-data #312

arnholm opened this issue Jan 4, 2022 · 2 comments · Fixed by #358
Assignees
Labels
feature Code based project improvement
Milestone

Comments

@arnholm
Copy link

arnholm commented Jan 4, 2022

With reference to discussion in issue #310 and multipart/form-data it is requested that Crow adds functionality to extract named parameters in an easy and intuitive way exemplified by the multipart_params class (this code is just for reference, please feel free to use, modify or completely rewrite as needed).

@arnholm arnholm changed the title Support for extracting named parameters form multipart/form-data Support for extracting named parameters from multipart/form-data Jan 4, 2022
@arnholm arnholm changed the title Support for extracting named parameters from multipart/form-data Support for extracting named parameters from multipart/form-data Jan 4, 2022
@The-EDev The-EDev added the feature Code based project improvement label Jan 4, 2022
@The-EDev
Copy link
Member

One thing to add to this issue is that it would be useful to restructure the multipart::part struct to have a map of headers (as opposed to a vector) so they're accessible by string comparison rather than indices.

@dranikpg
Copy link
Member

This fix sounds reasonable. I think there could be more, as I've always found the multipart api myself a bit hard/verbose to use.

One important missing feature is extracting parts by names. This has to be done manually now (by extracting the content-disposition header and searching for the name part 😵 )

Flask, for example, supports accessing data by name. Other web frameworks also do. I think we should provide at least some utility methods to make it working with multiple fields easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Code based project improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants