feat(middleware): add text/xml and application/xml to default compressible types#1126
Closed
happysnaker wants to merge 1 commit into
Closed
feat(middleware): add text/xml and application/xml to default compressible types#1126happysnaker wants to merge 1 commit into
happysnaker wants to merge 1 commit into
Conversation
…sible types XML content compresses very effectively and is commonly served by web applications. This adds text/xml and application/xml to the default compressible content types list. Fixes go-chi#920
VojtechVitek
requested changes
Jul 3, 2026
VojtechVitek
left a comment
Contributor
There was a problem hiding this comment.
The tests don't pass:
--- FAIL: TestCompressorWildcards (0.01s)
--- FAIL: TestCompressorWildcards/defaults (0.00s)
--- PASS: TestCompressorWildcards/no_wildcard (0.01s)
--- PASS: TestCompressorWildcards/invalid_wildcard_#1 (0.00s)
--- PASS: TestCompressorWildcards/invalid_wildcard_#2 (0.00s)
--- PASS: TestCompressorWildcards/valid_wildcard (0.00s)
--- PASS: TestCompressorWildcards/mixed (0.00s)
VojtechVitek
added a commit
that referenced
this pull request
Jul 3, 2026
PR #1126 added application/xml and text/xml to defaultCompressibleContentTypes but did not update the TestCompressorWildcards/defaults assertion, which hardcoded the expected count at 10. Derive it from len(defaultCompressibleContentTypes) instead so the test stays correct as defaults are added or removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
VojtechVitek
added a commit
that referenced
this pull request
Jul 3, 2026
…sible types (#1127) * feat(middleware): add text/xml and application/xml to default compressible types XML content compresses very effectively and is commonly served by web applications. This adds text/xml and application/xml to the default compressible content types list. Fixes #920 * test(middleware): derive default compressible types count from the slice PR #1126 added application/xml and text/xml to defaultCompressibleContentTypes but did not update the TestCompressorWildcards/defaults assertion, which hardcoded the expected count at 10. Derive it from len(defaultCompressibleContentTypes) instead so the test stays correct as defaults are added or removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: happysnaker <73147033+happysnaker@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Merged via #1127. Thank you 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #920
XML content compresses very effectively (typically 70-90% reduction) and is commonly served by web applications, APIs, and RSS/Atom feeds. This adds
text/xmlandapplication/xmlto the default compressible content types list.Note that
application/atom+xmlandapplication/rss+xmlwere already in the list — but generic XML was not.Changes
application/xmlandtext/xmltodefaultCompressibleContentTypes