Restore Go 1.13 compatibility
This commit is contained in:
parent
4976bd75e1
commit
6933c381bf
1 changed files with 2 additions and 2 deletions
|
|
@ -45,7 +45,7 @@ func NewClientFromHTTP(httpClient *http.Client) *Client {
|
|||
func AddHeader(name, value string) ClientOption {
|
||||
return func(tr http.RoundTripper) http.RoundTripper {
|
||||
return &funcTripper{roundTrip: func(req *http.Request) (*http.Response, error) {
|
||||
if len(req.Header.Values(name)) == 0 {
|
||||
if req.Header.Get(name) == "" {
|
||||
req.Header.Add(name, value)
|
||||
}
|
||||
return tr.RoundTrip(req)
|
||||
|
|
@ -57,7 +57,7 @@ func AddHeader(name, value string) ClientOption {
|
|||
func AddHeaderFunc(name string, getValue func(*http.Request) (string, error)) ClientOption {
|
||||
return func(tr http.RoundTripper) http.RoundTripper {
|
||||
return &funcTripper{roundTrip: func(req *http.Request) (*http.Response, error) {
|
||||
if len(req.Header.Values(name)) > 0 {
|
||||
if req.Header.Get(name) != "" {
|
||||
return tr.RoundTrip(req)
|
||||
}
|
||||
value, err := getValue(req)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue