func (h *authTokenMiddleware) RoundTrip(req *http.Request, next http.RoundTripper) (*http.Response, error) {
	token, err := h.provideToken(req.Context())
	if err != nil {
		return nil, err
	}
	req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
	return next.RoundTrip(req)
}
RoundTrip wraps an existing round tripper with a token providing round tripper.
It sets the Authorization header using a newly provided token for each request.
package httpclient
import (
	"context"
	"fmt"
	"net/http"
	"github.com/palantir/pkg/refreshable"
)
type TokenProvider func(context.Context) (string, error)
type authTokenMiddleware struct {
	provideToken TokenProvider
}