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

Accept header matching with ";version=1" is not working correctly #151

Open
perezh96 opened this issue Nov 22, 2024 · 1 comment
Open

Accept header matching with ";version=1" is not working correctly #151

perezh96 opened this issue Nov 22, 2024 · 1 comment

Comments

@perezh96
Copy link

I just wanted to add this issue here in case others run into the same issue when using this library.

When using a header that contains ";", retrieving the value using "TryGetValues" from System.Net.Http, it adds an extra space between the texts that contain ";"

if (!messageHeader.TryGetValues(matchHeader.Key, out var values) || values == null)

So for example:

If we pass in "application/xml;version=1", when we parse the value from the header it comes out as "application/xml; version=1". This causes the "MatchesHeader" method to fail and not match because of the extra space within the string.

I believe this to be an error in Microsoft's part but is an issue that could be mitigated in this library by maybe using a different method of retrieving the header value. Who knows if and when Microsoft will end up changing their code for retrieving the header value.

@richardszalay
Copy link
Owner

Thanks for this. I'll see if there's a way to access the raw/original header value.

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

No branches or pull requests

2 participants