-
-
Notifications
You must be signed in to change notification settings - Fork 625
chore: remove redundant async in readable.js #3643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this improving anything? This will worsen the DX as .json()
will disappear from the stacktrace.
Let me check the stack traces. |
'use strict'
const { Client } = require('./index')
async function run() {
const client = new Client('https://www.google.com')
const { body } = await client.request({
path: '/',
method: 'GET'
})
console.log(await body.json())
client.destroy()
}
run() In both branches I get: SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at consumeEnd (/home/aras/undici/lib/api/readable.js:505:20)
at BodyReadable.<anonymous> (/home/aras/undici/lib/api/readable.js:429:7)
at BodyReadable.emit (node:events:517:28)
at endReadableNT (node:internal/streams/readable:1400:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) |
Can I merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
fixes #3610
We dont need to wrap non awaited Promises/async calls.