Skip to content

Commit a07f0bf

Browse files
authored
fix(transport): set header when compression is enabled instead of add… (#755)
…ing a new one | Q | A | ----------------- | ---------- | Bug fix? | yes | New feature? | no | BC breaks? | no | Related Issue | Fix #742 [CR-5655] | Need Doc update | no ## Describe your change Replace the `.Add()` method on the headers variable by the `.Set()` method to avoid piling up the same header. ## What problem is this fixing? As stated by some user, the current transporter in Go adds a header each time a request is sent with compression enabled. Using the `.Set()` method instead fixes the issue. [CR-5655]: https://algolia.atlassian.net/browse/CR-5655?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 835301c commit a07f0bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

algolia/transport/transport.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func buildRequest(
286286
if isCompressionEnabled {
287287
switch c {
288288
case compression.GZIP:
289-
req.Header.Add("Content-Encoding", "gzip")
289+
req.Header.Set("Content-Encoding", "gzip")
290290
default:
291291
// Do nothing
292292
}

0 commit comments

Comments
 (0)