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

add validation support for multipart/form-data #510

Merged
merged 4 commits into from Jul 24, 2019

Conversation

birnbera
Copy link
Contributor

The WebOb returned by request.POST supports boundary delimited multipart/form-data POSTs. This change merely calls the mixed() method on the POST body when the content-type is multipart/form-data, allowing validation to proceed in cases where the body is a combination of e.g. json and binary data.

The WebOb returned by `request.POST` supports boundary delimited `multipart/form-data` POSTs. This change merely calls the `mixed()` method on the `POST` body when the content-type is `multipart/form-data`, allowing validation to proceed in cases where the body is a combination of e.g. json and binary data.
@leplatrem
Copy link
Contributor

Thanks for this contribution!

Any chance you could add a small test please?

@birnbera
Copy link
Contributor Author

birnbera commented Jul 5, 2019

@leplatrem Thanks for reviewing this pull request! Just added a couple tests.

I had to make a new service endpoint to test multiple fields in a multipart request. I left a comment regarding why, but basically it's because, as far as I can tell, there isn't any native support in colander or marshmallow for a MultiDict when it actually contains multiple values for a given key. I've seen some recipes for how to subclass list types to facilitate deserialization, but it's up to the user to pass such as schema to the view in order to get them working.

@birnbera
Copy link
Contributor Author

Any chance this could be reviewed?

Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, Thanks!

@leplatrem leplatrem merged commit 3554466 into Cornices:master Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants