Try to handle zlib errors
This commit is contained in:
parent
3ee6650e6d
commit
abcea88d0a
1 changed files with 7 additions and 0 deletions
|
@ -33,6 +33,13 @@ function handleRequest(requestor, url, params) {
|
|||
const contentEncoding = response.headers['content-encoding']?.trim().toLowerCase();
|
||||
|
||||
let responseContent = response;
|
||||
|
||||
// zlib errors
|
||||
responseContent.on("error", (e) => {
|
||||
logger.error(e);
|
||||
responseContent = response; // fallback
|
||||
});
|
||||
|
||||
if (contentEncoding === 'gzip' || contentEncoding === 'deflate') {
|
||||
responseContent = createUnzip();
|
||||
response.pipe(responseContent);
|
||||
|
|
Loading…
Add table
Reference in a new issue