fix: handle missing EOF when decompressing response

Closes: #1609
pull/1656/head
nsankbeil 1 year ago
parent 1439b6cc9c
commit 5640798fe4

@ -1,6 +1,6 @@
/* eslint-disable prefer-promise-reject-errors */
/* eslint-disable no-param-reassign */
import { createUnzip } from "node:zlib";
import { createUnzip, constants as zlibConstants } from "node:zlib";
import { http, https } from "follow-redirects";
@ -34,7 +34,11 @@ function handleRequest(requestor, url, params) {
let responseContent = response;
if (contentEncoding === 'gzip' || contentEncoding === 'deflate') {
responseContent = createUnzip();
responseContent = createUnzip({
flush: zlibConstants.Z_SYNC_FLUSH,
finishFlush: zlibConstants.Z_SYNC_FLUSH
});
// zlib errors
responseContent.on("error", (e) => {
logger.error(e);

Loading…
Cancel
Save