Skip to content

Conversation

@martincostello
Copy link
Collaborator

Fix Accept-Encoding parsing when there are multiple values or the value includes a quality.

See #3486 (comment).

Fix `Accept-Encoding` parsing when there are multiple values or the value includes a quality.

See #3486 (comment).
@martincostello martincostello added this to the v9.0.4 milestone Jul 8, 2025
Copilot AI review requested due to automatic review settings July 8, 2025 22:19
@martincostello martincostello enabled auto-merge (rebase) July 8, 2025 22:19
Copy link

Copilot AI left a 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 several Accept-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
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.88%. Comparing base (525a8a3) to head (3912061).
Report is 1 commits behind head on master.

✅ 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     
Flag Coverage Δ
Linux 93.88% <100.00%> (-0.03%) ⬇️
Windows 93.88% <100.00%> (-0.03%) ⬇️
macOS 93.88% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martincostello martincostello merged commit 3bff9ad into master Jul 8, 2025
11 of 12 checks passed
@martincostello martincostello deleted the fix-accept-encoding-handling branch July 8, 2025 22:23
This was referenced Aug 27, 2025
This was referenced Oct 24, 2025
github-actions bot pushed a commit to EelcoLos/nx-tinkering that referenced this pull request Oct 27, 2025
Updated
[swashbuckle.aspnetcore.cli](https://github.com/domaindrivendev/Swashbuckle.AspNetCore)
from 9.0.3 to 9.0.6.

<details>
<summary>Release notes</summary>

_Sourced from [swashbuckle.aspnetcore.cli's
releases](https://github.com/domaindrivendev/Swashbuckle.AspNetCore/releases)._

## 9.0.6

## What's Changed

* Bump redoc from 2.5.0 to 2.5.1 by @​dependabot in
domaindrivendev/Swashbuckle.AspNetCore#3587
* Bump swagger-ui from 5.29.1 to 5.29.2 by @​dependabot in
domaindrivendev/Swashbuckle.AspNetCore#3595

**Full Changelog**:
domaindrivendev/Swashbuckle.AspNetCore@v9.0.5...v9.0.6


## 9.0.5

## What's Changed

* .NET 10 preparation by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3565
* Update NuGet packages by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3573
* Fix anchors by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3577
* Bump swagger-ui-dist from 5.27.1 to 5.29.1

**Full Changelog**:
domaindrivendev/Swashbuckle.AspNetCore@v9.0.4...v9.0.5


## 9.0.4

## What's Changed

* Fix incorrect `ETag` values by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3490
* Fix `Accept-Encoding` parsing by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3492
* Check `Accept-Encoding` quality by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3493
* Update xunit packages by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3500
* Add release notes configuration by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3502
* Simplify release workflow by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3503
* Bump xunit dependencies by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3508
* Update NuGet dependencies by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3513
* Remove `WebHost` usage from tests by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3517
* Fix typos by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3520
* Sign-off commits by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3526
* Add zizmor by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3528
* Fix permissions by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3529
* Bump zizmor by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3535
* Add default `$type` discriminator for `[JsonPolymorphic]` by @​lilinus
in domaindrivendev/Swashbuckle.AspNetCore#3496
* Update NuGet dependencies by @​martincostello in
domaindrivendev/Swashbuckle.AspNetCore#3545

## New Contributors

* @​lilinus made their first contribution in
domaindrivendev/Swashbuckle.AspNetCore#3496

**Full Changelog**:
domaindrivendev/Swashbuckle.AspNetCore@v9.0.3...v9.0.4


Commits viewable in [compare
view](domaindrivendev/Swashbuckle.AspNetCore@v9.0.3...v9.0.6).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=swashbuckle.aspnetcore.cli&package-manager=nuget&previous-version=9.0.3&new-version=9.0.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant