phin icon indicating copy to clipboard operation
phin copied to clipboard

Exception when requesting a compressed stream

Open yetzt opened this issue 2 years ago • 0 comments

It appears, when stream: true and compression: true, centra delivers a gzip stream which does no contain a headers property, causing an exception in phin.js at res.headers.hasOwnProperty('location')

const phin = require("phin");

phin({
	url: "https://github.com/",
	stream: true,
	compression: true,
}).then(function(resp){
	console.log(resp);
}).catch(function(err){
	console.log(err.stack);
});
TypeError: Cannot read properties of undefined (reading 'hasOwnProperty')
    at phin (.../node_modules/phin/lib/phin.js:60:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

yetzt avatar Jul 31 '23 10:07 yetzt