nytimes/gziphandler

Use functional options

adammck opened this issue · 3 comments

Dear Lazyweb: It would be nice if our API looked less like

gz.NewGzipLevelAndMinSize(1, 1024)(myHandler)

and more like

gz.New(myHandler, gz.CompressionLevel(1), gz.MinSize(1024))

See Functional options for friendly APIs. I'm open to other solutions, too.

After playing around with more and more go-kit, I've been leaning towards the latter lately.

This was fixed with the merging of #51.


The main difference was that the options take the form:

wrap, _ := gz.GzipHandlerWithOpts(gz.CompressionLevel(1), gz.MinSize(1024))
wrap(myHandler)

instead of:

gz.New(myHandler, gz.CompressionLevel(1), gz.MinSize(1024))

Either this should be closed or considered a request to add the New function described above.

If this is fixed, it might be time for close of this issue, isn't it?
I'm discovering this project and most open issues seem to be in fact done. Discovering that after the read of a long discussion is unexpected.