File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 14
14
package main
15
15
16
16
import (
17
+ "fmt"
17
18
"net/http"
18
19
"net/url"
19
20
"os"
@@ -33,11 +34,11 @@ import (
33
34
34
35
type transportWithApiKey struct {
35
36
underlyingTransport http.RoundTripper
36
- apiKey * string
37
+ apiKey string
37
38
}
38
39
39
40
func (t * transportWithApiKey ) RoundTrip (req * http.Request ) (* http.Response , error ) {
40
- req .Header .Add ("Authorization" , "ApiKey " + * t .apiKey )
41
+ req .Header .Add ("Authorization" , fmt . Sprintf ( "ApiKey %s" , t .apiKey ) )
41
42
return t .underlyingTransport .RoundTrip (req )
42
43
}
43
44
@@ -138,11 +139,12 @@ func main() {
138
139
}
139
140
140
141
if * esApiKey != "" {
142
+ apiKey := * esApiKey
141
143
httpClient = & http.Client {
142
144
Timeout : * esTimeout ,
143
145
Transport : & transportWithApiKey {
144
146
underlyingTransport : httpTransport ,
145
- apiKey : esApiKey ,
147
+ apiKey : apiKey ,
146
148
},
147
149
}
148
150
}
You can’t perform that action at this time.
0 commit comments