Skip to content

Allow customizing the HTTP client

Grégoire Détrez requested to merge gregoire/http-client into main

It is useful and relatively common to customize http.Client, e.g. to use a custom Transport or changing the redirect policy. This change allows users to do that by adding an HTTPClient field to both client.Config and submit.Config.

My immediate use case is being able to use promhttp to easily collect request metrics on the client side. This work by wrapping http.RoundTripper with one of the InstrumentRoundTripper* functions. This change allows me to do that without having to add the instrumentation (and its dependencies) in sigsum-go.

Merge request reports