go-chi / chi

lightweight, idiomatic and composable router for building Go HTTP services
https://go-chi.io
MIT License
17.57k stars 967 forks source link

middleware.Compress should by default compress `text/xml`, `application/xml`, and arguably `text/*` #920

Open eteran opened 3 weeks ago

eteran commented 3 weeks ago

As the title suggests, I think that text/xml and application/xml should be in defaultCompressibleContentTypes given that it is text and will compress very effectively in nearly all situations. I think it is pretty common to compress XML data.

For now, of course I can manually provide the list of types.

VojtechVitek commented 3 weeks ago

@eteran I agree. Feel free to submit a PR.

eteran commented 3 weeks ago

Here's a link to the PR: https://github.com/go-chi/chi/pull/921

It does two things:

  1. it makes the default list reuse the same logic as the custom list so it also supports wild cards
  2. changes the default list to have text/* and application/xml

If you prefer that the default list not support wildcards, I can change the PR to just add the two mime-types for XML, but personally I think all of text/* should likely be compressed

eteran commented 1 week ago

@VojtechVitek don't mean to bug, but I just wanted to check in. The PR is currently waiting for approval to run the CI workflow. If you're busy, no worries, just didn't want it to fall through the cracks. Thanks!