Conversation
Uses the `accept-header` crate
|
Hi, thank you for the PR! It looks like the The relevant code (these few dozen lines) are basically all that's needed, The mediatype crate looks promising and could also replace |
|
Thanks for taking a look! So, in the end, I've just done a lightweight content negotiation function in my application with custom serialisation logic for each output type, which allows me to switch between row-based serialisation and document-based serialisation. |
Currently, (as far as I understand), axum-codec only works with
Acceptheaders which contain a single mime type, and provide no relative weights. That means only a small subset of the full range of Accept headers supported by the HTTP spec (rfc7231) will work with it.This PR attempts to support full content negotiation of
Acceptheaders, including relative weights. To do this, it relies heavily on a pre-existing crate, accept-header, rather than adding all the parsing logic here.I'm very new to rust (started writing it yesterday), so I've probably made this much more verbose than it needs to be. Would appreciate any input from more experienced rustaceans.