Closed 043674543 closed 4 months ago
@043674543 thank you for your contribution. what do you think about adjusting the changeset a bit and extend the functionality.
I think of setting the whole default header map via config option (default should be make(http.Header)
).
So the option could be named:
func WithConnectHeaders(headers http.Header) HttpClientOption {
return func(config *httpClientConfig) {
config.connectHeaders = headers
}
}
And then passing this option to the newConnectDialer
and set it directly where the connectDialer is instantiated:
dialer := &connectDialer{
logger: logger,
ProxyUrl: *proxyUrl,
Dialer: _dialer,
Timeout: timeout,
DefaultHeader: make(http.Header), // set it here directly
EnableH2ConnReuse: true,
}
This would give the user the flexibility to add more than just the user-agent header.
@043674543 covered now in https://github.com/bogdanfinn/tls-client/releases/tag/v1.7.7 thank you very much.
The CONNECT request contains a useragent which we can set in the connect.go
(not a golang coder typically so please feel free to raise any issues this may have)