Closed
Description
We're using the client to query metrics in victoria metrics, which we only have a bearer token for authentication, meaning we need to add header Authorization: Bearer xxx
(rather than adding a username/password to the URL)
Maybe I'm missing something, but that doesn't see possible with this client (other than adding a custom round tripper and injecting headers, though the Go docs say RoundTrip should not modify the request
)
It would be great to extend api.Config
to support custom headers, such as:
// Config defines configuration parameters for a new client.
type Config struct {
// The address of the Prometheus to connect to.
Address string
// Headers contains custom HTTP request headers.
Headers map[string]string
// Client is used by the Client to drive HTTP requests. If not provided,
// a new one based on the provided RoundTripper (or DefaultRoundTripper) will be used.
Client *http.Client
// RoundTripper is used by the Client to drive HTTP requests. If not
// provided, DefaultRoundTripper will be used.
RoundTripper http.RoundTripper
}
I looked through open issues and PRs and couldn't see anything relating to this, though I'd be surprised if we were the first to run into this issue so sorry if this is a duplicate