mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-02 10:52:49 +02:00
zero: add user-agent to requests (#5078)
This commit is contained in:
parent
86c82c0374
commit
2da4801d3a
3 changed files with 9 additions and 3 deletions
|
@ -6,12 +6,16 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/version"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultMinTokenTTL = time.Minute * 5
|
||||
)
|
||||
|
||||
var userAgent = version.UserAgent()
|
||||
|
||||
type client struct {
|
||||
tokenProvider TokenProviderFn
|
||||
httpClient *http.Client
|
||||
|
@ -44,6 +48,7 @@ func (c *client) Do(req *http.Request) (*http.Response, error) {
|
|||
return nil, fmt.Errorf("error getting token: %w", err)
|
||||
}
|
||||
req.Header.Set("Authorization", "Bearer "+token)
|
||||
req.Header.Set("User-Agent", userAgent)
|
||||
|
||||
return c.httpClient.Do(req)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue