Skip to content

Commit 9e2c892

Browse files
authored
Merge pull request #299 from DataDog/clamoriniere/fixExtraHeaderInit
2 parents f1bd9ee + 56d8ed0 commit 9e2c892

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)