Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(exporter-collector): set content-encoding header only when compre…
…ssing
- Loading branch information
1 parent
6bceae0
commit 8805cea
Showing
2 changed files
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,6 @@ export function sendWithHttp<ExportItem, ServiceRequest>( | |
headers: { | ||
'Content-Length': Buffer.byteLength(data), | ||
'Content-Type': contentType, | ||
'Content-Encoding': 'gzip', | ||
...collector.headers, | ||
}, | ||
agent: collector.agent, | ||
|
@@ -84,6 +83,7 @@ export function sendWithHttp<ExportItem, ServiceRequest>( | |
|
||
switch (collector.compression) { | ||
case CompressionAlgorithm.GZIP: { | ||
req.setHeader('Content-Encoding', 'gzip'); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alisabzevari
Author
Contributor
|
||
const dataStream = readableFromBuffer(data); | ||
dataStream.on('error', onError) | ||
.pipe(gzip).on('error', onError) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this might be tricky. User maybe be passing such header already with more options
deflate, gzip
for example and then it will try to override this header again. The safest approach should be to set this first and then override with collector headers. I'm talking about this