httpcompression
httpcompression copied to clipboard
Split adapter and wrapper into different entities
Motivation
I work on projects where I cannot use the Adapter(..) directly. I need to call the *.ServeHTTP(..) method directly.
Changes
- This PR split the logic of the
Adapter(..)and the included wrapper into different entities:Adapter(..): Which will work as before (see tests)ResponseWriterFactoryFactory.Create(..): Which is used to create a wrappedhttp.ResponseWriterfrom a given one, which is compressing (if requested).
- Split some stuff from
adapter.gointo other files (likeconfig.goandresponse_writer_factory.go) - Fixed go build flags to be 1.17+
- Makes it possible to run all tests (but without cgo dependencies) if no cgo is available.
- Some typo fixes
- Added
MinSizeRequestFunc(func(*http.Request) (int, error))to be able to used instead ofMinSize(..). Makes it able to determineminSizeon each call ofResponseWriterFactoryFactory.Create(..)based on the request. - Added
ErrorHandler(..)to be able to react to errors inside of the handling chain of httpcompression. - Introduced
ErrHijackerNotSupportedinstead of enclosed error to be able to check for it directly.
@CAFxX is this project still alive?