X Tutup
Skip to content

Commit 6933c38

Browse files
committed
Restore Go 1.13 compatibility
1 parent 4976bd7 commit 6933c38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func NewClientFromHTTP(httpClient *http.Client) *Client {
4545
func AddHeader(name, value string) ClientOption {
4646
return func(tr http.RoundTripper) http.RoundTripper {
4747
return &funcTripper{roundTrip: func(req *http.Request) (*http.Response, error) {
48-
if len(req.Header.Values(name)) == 0 {
48+
if req.Header.Get(name) == "" {
4949
req.Header.Add(name, value)
5050
}
5151
return tr.RoundTrip(req)
@@ -57,7 +57,7 @@ func AddHeader(name, value string) ClientOption {
5757
func AddHeaderFunc(name string, getValue func(*http.Request) (string, error)) ClientOption {
5858
return func(tr http.RoundTripper) http.RoundTripper {
5959
return &funcTripper{roundTrip: func(req *http.Request) (*http.Response, error) {
60-
if len(req.Header.Values(name)) > 0 {
60+
if req.Header.Get(name) != "" {
6161
return tr.RoundTrip(req)
6262
}
6363
value, err := getValue(req)

0 commit comments

Comments
 (0)
X Tutup