Skip to content

Commit d7b767b

Browse files
VojtechVitekhappysnakerclaude
authored
feat(middleware): add text/xml and application/xml to default compressible 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) <[email protected]> --------- Co-authored-by: happysnaker <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
1 parent 3b50c7c commit d7b767b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎middleware/compress.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ var defaultCompressibleContentTypes = []string{
2323
"application/json",
2424
"application/atom+xml",
2525
"application/rss+xml",
26+
"application/xml",
27+
"text/xml",
2628
"image/svg+xml",
2729
}
2830

‎middleware/compress_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func TestCompressorWildcards(t *testing.T) {
119119
}{
120120
{
121121
name: "defaults",
122-
typesCount: 10,
122+
typesCount: len(defaultCompressibleContentTypes),
123123
},
124124
{
125125
name: "no wildcard",

0 commit comments

Comments
 (0)