Skip to content

Commit

Permalink
another tp.Client helper for Authorization header
Browse files Browse the repository at this point in the history
  • Loading branch information
btoews committed Nov 16, 2023
1 parent 746fdb8 commit 0bc0c9a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ func WithHTTP(h *http.Client) ClientOption {
// WithBearerAuthentication specifies a token to be sent in requests to the
// specified host in the `Authorization: Bearer` header.
func WithBearerAuthentication(hostname, token string) ClientOption {
token = "Bearer " + token
return WithAuthentication(hostname, "Bearer "+token)
}

// WithBearerAuthentication specifies a token to be sent in requests to the
// specified host in the `Authorization` header.
func WithAuthentication(hostname, token string) ClientOption {
return func(c *Client) {
if c.http == nil {
cpy := *http.DefaultClient
Expand Down

0 comments on commit 0bc0c9a

Please sign in to comment.