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

Split adapter and wrapper into different entities #57

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

blaubaer
Copy link

Motivation

I work on projects where I cannot use the Adapter(..) directly. I need to call the *.ServeHTTP(..) method directly.

Changes

  1. 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 wrapped http.ResponseWriter from a given one, which is compressing (if requested).
  2. Split some stuff from adapter.go into other files (like config.go and response_writer_factory.go)
  3. Fixed go build flags to be 1.17+
  4. Makes it possible to run all tests (but without cgo dependencies) if no cgo is available.
  5. Some typo fixes
  6. Added MinSizeRequestFunc(func(*http.Request) (int, error)) to be able to used instead of MinSize(..). Makes it able to determine minSize on each call of ResponseWriterFactoryFactory.Create(..) based on the request.
  7. Added ErrorHandler(..) to be able to react to errors inside of the handling chain of httpcompression.
  8. Introduced ErrHijackerNotSupported instead of enclosed error to be able to check for it directly.

@blaubaer
Copy link
Author

@CAFxX is this project still alive?

@blaubaer
Copy link
Author

@CAFxX can you give some feedback for this PR? 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.

1 participant