Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Add Fuzzy Matching to registeredCodecs #3476

Open
sosyz opened this issue Dec 2, 2024 · 1 comment
Open

[Proposal] Add Fuzzy Matching to registeredCodecs #3476

sosyz opened this issue Dec 2, 2024 · 1 comment
Labels
proposal proposal

Comments

@sosyz
Copy link

sosyz commented Dec 2, 2024

Proposal description

The current codec registration mechanism in the encoding package uses a strict map-based approach for matching codec names, which limits flexibility when handling variations in Content-Type headers. To address this, we propose enhancing the registeredCodecs map[string]Codec to support fuzzy matching. This enhancement will allow for more adaptable codec lookups. Given that the number of codec implementations is relatively small, this change is expected to have a minimal impact on performance.

Implementation mode

To implement this enhancement, we suggest introducing a fuzzy matching mechanism that can evaluate codec names based on pattern recognition or similarity scoring. This could be achieved through the use of existing fuzzy string matching libraries or by developing a custom algorithm tailored to the package's needs.

Usage demonstration

Consider a scenario where a request is sent with a Content-Type header of multipart/form-data; boundary=----WebKitFormBoundaryyb1zYhTI38xpQxBK. The proposed fuzzy matching system would enable the codec registration to match this header to a more generalized pattern like multipart/form-data; boundary=*. This would allow the system to handle variations in boundary values seamlessly.

Please request to consider this change and, if possible, assign it to me.

@sosyz sosyz added the proposal proposal label Dec 2, 2024
@Windfarer
Copy link
Member

SGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal proposal
Projects
None yet
Development

No branches or pull requests

2 participants