factory.go 597 B

12345678910111213141516171819
  1. package headerwriter
  2. import "net/http"
  3. // Factory is a struct that provides methods to create HeaderBuilder instances
  4. type Factory struct {
  5. config *Config
  6. }
  7. // NewFactory creates a new factory instance with the provided configuration
  8. func NewFactory(config *Config) *Factory {
  9. return &Factory{config: config}
  10. }
  11. // NewHeaderBuilder creates a new HeaderBuilder instance with the provided request headers
  12. // NOTE: should URL be string here?
  13. func (f *Factory) NewHeaderWriter(originalResponseHeaders http.Header, url string) *Writer {
  14. return newWriter(f.config, originalResponseHeaders, url)
  15. }