Skip to content

Commit

Permalink
fix: make options.WithHeader utils case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Nov 8, 2023
1 parent cbbda68 commit a26e311
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions option/requestoption.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func WithMaxRetries(retries int) RequestOption {
// any value if there was one already present.
func WithHeader(key, value string) RequestOption {
return func(r *requestconfig.RequestConfig) error {
r.Request.Header[key] = []string{value}
r.Request.Header.Set(key, value)
return nil
}
}
Expand All @@ -87,15 +87,15 @@ func WithHeader(key, value string) RequestOption {
// onto any existing values.
func WithHeaderAdd(key, value string) RequestOption {
return func(r *requestconfig.RequestConfig) error {
r.Request.Header[key] = append(r.Request.Header[key], value)
r.Request.Header.Add(key, value)
return nil
}
}

// WithHeaderDel returns a RequestOption that deletes the header value(s) associated with the given key.
func WithHeaderDel(key string) RequestOption {
return func(r *requestconfig.RequestConfig) error {
delete(r.Request.Header, key)
r.Request.Header.Del(key)
return nil
}
}
Expand Down

0 comments on commit a26e311

Please sign in to comment.