reject promise correctly

This commit is contained in:
Vikhyath Mondreti
2026-01-20 16:34:19 -08:00
parent bcf65aa369
commit 7af5c189de

View File

@@ -988,6 +988,11 @@ export function secureFetchWithPinnedIP(
const chunks: Buffer[] = []
res.on('data', (chunk: Buffer) => chunks.push(chunk))
res.on('error', (error) => {
reject(error)
})
res.on('end', () => {
const bodyBuffer = Buffer.concat(chunks)
const body = bodyBuffer.toString('utf-8')