Skip to content

Commit

Permalink
fix: Disable content encoding for pushgateway delete requests (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano authored Mar 9, 2023
1 parent 0382911 commit 0f872ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ project adheres to [Semantic Versioning](http://semver.org/).

### Changed

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

Expand Down
3 changes: 3 additions & 0 deletions lib/pushgateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ async function useGateway(method, job, groupings) {
});

return new Promise((resolve, reject) => {
if (method === 'DELETE' && options.headers) {
delete options.headers['Content-Encoding'];
}
const req = httpModule.request(options, resp => {
let body = '';
resp.setEncoding('utf8');
Expand Down

0 comments on commit 0f872ff

Please sign in to comment.