Skip to content

Commit 0f872ff

Browse files
authored
fix: Disable content encoding for pushgateway delete requests (#551)
1 parent 0382911 commit 0f872ff

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ project adheres to [Semantic Versioning](http://semver.org/).
1313

1414
### Changed
1515

16+
- Disable custom content encoding for pushgateway delete requests in order to
17+
avoid failures from the server when using `Content-Encoding: gzip` header.
1618
- Refactor `escapeString` helper in `lib/registry.js` to improve performance and
1719
avoid an unnecessarily complex regex.
1820

lib/pushgateway.js

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ async function useGateway(method, job, groupings) {
6262
});
6363

6464
return new Promise((resolve, reject) => {
65+
if (method === 'DELETE' && options.headers) {
66+
delete options.headers['Content-Encoding'];
67+
}
6568
const req = httpModule.request(options, resp => {
6669
let body = '';
6770
resp.setEncoding('utf8');

0 commit comments

Comments
 (0)