Skip to content

Commit 56d8ed0

Browse files
committed
Fix client.ExtraHeader initialisation in NewClient()
Signed-off-by: cedric lamoriniere <[email protected]>
1 parent f1bd9ee commit 56d8ed0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func NewClient(apiKey, appKey string) *Client {
6464
HttpClient: http.DefaultClient,
6565
RetryTimeout: time.Duration(60 * time.Second),
6666
rateLimitingStats: make(map[string]RateLimit),
67+
ExtraHeader: make(map[string]string),
6768
}
6869
}
6970

integration/client_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ func TestExtraHeader(t *testing.T) {
5959
assert.Empty(t, c.ExtraHeader)
6060
})
6161
}
62+
63+
func TestInsertExtraHeader(t *testing.T) {
64+
t.Run("ExtraHeader map should be initialised", func(t *testing.T) {
65+
c := datadog.NewClient("foo", "bar")
66+
c.ExtraHeader["foo"] = "bar"
67+
assert.Equal(t, c.ExtraHeader["foo"], "bar")
68+
})
69+
}

0 commit comments

Comments
 (0)