Skip to content

Cleanup CompressHandlerLevel#173

Merged
elithrar merged 1 commit intogorilla:masterfrom
fharding1:compress-cleanup
Nov 18, 2019
Merged

Cleanup CompressHandlerLevel#173
elithrar merged 1 commit intogorilla:masterfrom
fharding1:compress-cleanup

Conversation

@fharding1
Copy link
Contributor

Fixes nothing

Summary of Changes

Instead of having a labeled for loop that we can break to and having all the compression logic in that loop, make the loop responsible only for detecting the encoding, so that the important logic isn't nested deeply. Also updates some variable names for better readability.

PS: Make sure your PR includes/updates tests! If you need help with this part, just ask!

break L
// detect what encoding to use
var encoding string
for _, curEnc := range strings.Split(r.Header.Get("Accept-Encoding"), ",") {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we could also setup the encWriter here, but I tried that and I think the code is more readable when this loop is only responsible for detecting the encoding.

@elithrar elithrar merged commit 597a9be into gorilla:master Nov 18, 2019
@elithrar
Copy link
Contributor

Perfect, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants