http_parser icon indicating copy to clipboard operation
http_parser copied to clipboard

Consider making MediaType a compile-time constant

Open pattobrien opened this issue 6 months ago • 0 comments

I'm working on a code-gen package to improve the UX of creating backend apps. One of the primary use cases is to register acceptable MediaTypes for a given endpoint, and map it to a body parser. Since MediaType is not a compile-time constant, I'm unable to achieve the following:

@BodyParser({MediaType.multipartForm})
UserDto userFromForm(List<int> data) => _$UserFromForm

Would we be willing to reconsider looking into this issue or accept a PR?

My workaround for the time being will be to create my own MediaType class, but I'd ideally like to not fragment from popular packages like this one.

pattobrien avatar Jan 24 '24 19:01 pattobrien