sindresorhus / got

🌐 Human-friendly and powerful HTTP request library for Node.js
MIT License
14.27k stars 935 forks source link

Requests are resolved with empty body #1496

Closed arcanis closed 4 years ago

arcanis commented 4 years ago

Describe the bug

Ref: https://github.com/sindresorhus/got/pull/1256#issuecomment-706609515

Got on Node 14.0.0 returns empty bodies for all requests. After double-checking (I already did but messed the Node upgrade), it seems to work on 14.13. Still, it's an annoying behaviour for a minor release since it would make upgrading got in Yarn a BC-breaking change 🙁

Code to reproduce

The default one is enough:

const got = require('got');

(async () => {
    try {
        const response = await got('https://sindresorhus.com');
        console.log(response.body);
        //=> '<!doctype html> ...'
    } catch (error) {
        console.log(error.response.body);
        //=> 'Internal server error ...'
    }
})();

Checklist

arcanis commented 4 years ago

Seems like both 14.0 and 14.1 are affected; starting from 14.2 the bug disappears

szmarczak commented 4 years ago

Duplicate of #1395 #1349 #1172