ponzu-cms / ponzu

Headless CMS with automatic JSON API. Featuring auto-HTTPS from Let's Encrypt, HTTP/2 Server Push, and flexible server framework written in Go.
https://docs.ponzu-cms.org
BSD 3-Clause "New" or "Revised" License
5.7k stars 385 forks source link

Close the gzip writer in defer, not in Write impl #205

Closed nilslice closed 6 years ago

nilslice commented 6 years ago

We should close the *gzip.Writer in a defer after it's created instead of in the Write() implementation: https://github.com/ponzu-cms/ponzu/blob/master/system/api/gzip.go#L46

If anyone would like to do this, please feel free -- I'm away from my machine, but noticed this could be better while reviewing some code.

robbawebba commented 6 years ago

@nilslice I would love to help with this issue if it's still up for grabs!

nilslice commented 6 years ago

@robbawebba - go for it! Appreciate your help.

nilslice commented 6 years ago

Thanks again, @robbawebba!

robbawebba commented 6 years ago

Thanks @nilslice! I'm looking forward to more contributions to ponzu :)

nilslice commented 6 years ago

@robbawebba - fantastic! just added you to the #ponzu channel on Gopher's Slack. I look forward to working together more too.