mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Prefer http.Header over map[string]string to allow for multi-valued headers
This commit is contained in:
@@ -156,7 +156,7 @@ type Config struct {
|
||||
// TLSConfig is ignored if HttpClient is set.
|
||||
TLSConfig *TLSConfig
|
||||
|
||||
Headers map[string]string
|
||||
Headers http.Header
|
||||
}
|
||||
|
||||
// ClientConfig copies the configuration with a new client address, region, and
|
||||
@@ -676,9 +676,7 @@ func (c *Client) newRequest(method, path string) (*request, error) {
|
||||
}
|
||||
}
|
||||
|
||||
for key, value := range c.config.Headers {
|
||||
r.header.Set(key, value)
|
||||
}
|
||||
r.header = c.config.Headers
|
||||
|
||||
return r, nil
|
||||
}
|
||||
|
||||
@@ -344,8 +344,8 @@ func TestParseWriteMeta(t *testing.T) {
|
||||
func TestClientHeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
c, s := makeClient(t, func(c *Config) {
|
||||
c.Headers = map[string]string{
|
||||
"Hello": "World",
|
||||
c.Headers = http.Header{
|
||||
"Hello": []string{"World"},
|
||||
}
|
||||
}, nil)
|
||||
defer s.Stop()
|
||||
|
||||
Reference in New Issue
Block a user