proposal: Use HTTPClient interface instead of *http.Client instance
We can use HTTPClient interface instead of *http.Client instance. For example, we have a custom httpclient that includes features such as our built-in security authentication certificate, retries, and circuit breaker. However, since this library uses *http.Client, this prevents us using these features. It is also very complicated to wrap the corresponding functionality. Currently, there is no use to more internals, interfaces is a very good solution.
type HTTPClient interface{
Do(*http.Request)(*http.Response, error)
}
Makes sense. Are you open to submit a PR?
@jensneuse Okay, I will submit a PR later
@jensneuse I'm afraid we can not do it due to https://github.com/nhooyr/websocket/issues/249
I see, maybe you have to somehow wrap a custom http client into a transport.
Sure, use a custom transport instead.