I am using the node-fetch library and it by-default decompresses the response. I want to make a POST request which returns gzipped content and I want to pipe the POST request response to the response.
The code I am currently using is here:
router.post('/getData', async(request, response) => {
fetch(`http://url:port/path`, { method: 'POST', headers: {'Accept-Encoding': 'gzip'}, body: ''})
.then(data=> {
return data.body.pipe(response);
}
}
}
I understand that the node-fetch library decompresses the data by default. I do not need this. I want to pass the compressed data directly using streams. (Like a proxy)