bent icon indicating copy to clipboard operation
bent copied to clipboard

Error response body is a still promise

Open FrankMartinezSRC opened this issue 5 years ago • 2 comments

It seems the issue #81, and #91 by extension, is still happening.

Code to reproduce:

const bent = require('bent');

(async () ={
    try {
        await bent('POST', 'json', `https://google.com`)();
    } catch (err) {
        console.error(err);
    }
})();

Outputs:

Promise { pending }

FrankMartinezSRC avatar Jun 05 '20 14:06 FrankMartinezSRC

I can confirm that responseBody is a Pending Promise. However, it is possible to get the body using .json(). But this causes responseBody to show up as Error: body stream is locked when observed via Debugger.

Templum avatar Jun 09 '20 10:06 Templum

Same here, responseBody is a pending promise in the Browser when the statusCode is 400. I'm using 7.3.12.

seanthingee avatar Jul 19 '22 18:07 seanthingee