axum icon indicating copy to clipboard operation
axum copied to clipboard

Allow setting multer::Multipart constraints

Open martijnarts opened this issue 1 year ago • 5 comments

Feature Request

Motivation

I'm running into a length limit exceeded error from multer when trying to read a file coming in from a Multipart form. Multer supports Constraints to avoid this, but axum's multipart extractor does not allow forwarding these.

Proposal

I'm not super sure how this could be implemented, since the constraints can't be passed through the parameter typing. Either there might need to be some documented recommended way of parsing the request manually inside the handler, or maybe the multipart extractor needs to be a bit fancier to allow passing constraints.

Alternatives

For now, I'll "vendor" the Multipart extractor, since it seems simple enough, to add that functionality, but it seems like something axum's native extractor should support.

martijnarts avatar Dec 07 '22 13:12 martijnarts