Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup CompressHandlerLevel #173

Merged
merged 1 commit into from
Nov 18, 2019
Merged

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.

None yet

2 participants