Skip to content

More efficient mime type parsing in server SDKs; avoid mime crate #2666

Open
@david-perez

Description

@david-perez

We're currently creating one OnceCell per operation backing a static mime::Mime type for the operation's expected (if present) client Accept header value, only to then decompose it into type + subtype and perform a case-insensitive string comparison check against the actual incoming Accept header value.

It would be more efficient to directly compare &strs and avoid incurring the atomic read.

A simpler, more efficient, and type-safe approach would be to directly switch to something like mediatype, which is const-constructible and zero-copy. Note that mime is not actively maintained.

See #2607 (comment) and #2629, the PR where we started using OnceCells for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions