tower-http
tower-http copied to clipboard
ValidateRequest: Accept header parsing is incorrect
Turns out parsing the Accept header isn't just a matter of splitting on commas, like we do here.
See https://github.com/http-rs/http-types/issues/349 for more details.
@82marbag do you wanna look into this?
I asked nicely and now this library has a parser for this you can use: https://github.com/picoHz/mediatype/issues/4 https://docs.rs/mediatype/latest/mediatype/struct.MediaTypeList.html
@davidpdrsn should I add that as a dependency? Are you ok with it?
That crate seems similar to mime which I believe tower-http already uses already.
Yes, we're using mime. Do you prefer to move to that new crate or should I have both, the last crate for this specific issue and gradually move away from mime?
If we can use mime then I think we should do that.
I would not re-implement that in tower-http, I'd either
- ask to implement or implement it myself in mime
- use the mediatype crate
To implement it here maybe nom or manually. Do you have any other suggestion or which of these should I go for?
I think the previous reply was already an endorsement of
ask to implement or implement it myself in mime
and I agree.