Open david-perez opened 1 week ago
Currently, we re-parse expected request Content-Type header values into mime::Mimes 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.
Content-Type
mime::Mime
aws_smithy_http_server::protocol::content_type_header_classifier_smithy
const
Mime
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
Accept
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.
Currently, we re-parse expected request
Content-Type
header values intomime::Mime
s every time we service a request. It'd be more efficient ifaws_smithy_http_server::protocol::content_type_header_classifier_smithy
took in directly aconst
Mime
type.Note that we already do this to check the
Accept
header (against theContent-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-L261It'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.