smithy-rs
smithy-rs copied to clipboard
Code-generate `const` `Mime` values for each expected `Content-Type` in a request
Currently, we re-parse expected request Content-Type
header values into mime::Mime
s every time we service a request. It'd be more efficient if aws_smithy_http_server::protocol::content_type_header_classifier_smithy
took in directly a const
Mime
type.
Note that we already do this to check the Accept
header (against the Content-Type
of the response): https://github.com/smithy-lang/smithy-rs/blob/e912cf5e8e4d976c408d5b2c78b1d92320090ada/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt#L243-L261
It's probably better if we decide on https://github.com/smithy-lang/smithy-rs/issues/2666 before tackling this issue, to avoid throwaway work.
Originally source of this issue is https://github.com/smithy-lang/smithy-rs/pull/3690#discussion_r1638330220.