-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix Accept-Encoding
parsing
#3492
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
Conversation
Fix `Accept-Encoding` parsing when there are multiple values or the value includes a quality. See #3486 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes how the middleware and its tests handle Accept-Encoding
headers when there are multiple encoding values or quality parameters.
- Expanded the integration test to use a
[Theory]
with severalAccept-Encoding
header permutations. - Updated
IsGZipAccepted
to rely on typed headers (GetTypedHeaders().AcceptEncoding
) instead of raw string comparison. - Iterates header values properly to detect
gzip
offers.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
test/Swashbuckle.AspNetCore.IntegrationTests/ReDocIntegrationTests.cs | Converted the single-case test to a parameterized theory and added multiple Accept-Encoding scenarios. |
src/Shared/EmbeddedResourceProvider.cs | Switched to typed headers for Accept-Encoding and updated the IsGZipAccepted method to loop through parsed values. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #3492 +/- ##
==========================================
- Coverage 93.91% 93.88% -0.03%
==========================================
Files 110 110
Lines 3811 3812 +1
Branches 723 724 +1
==========================================
Hits 3579 3579
- Misses 232 233 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fix
Accept-Encoding
parsing when there are multiple values or the value includes a quality.See #3486 (comment).