bent
bent copied to clipboard
Error response body is a still promise
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 }
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.
Same here, responseBody is a pending promise in the Browser when the statusCode is 400. I'm using 7.3.12.