mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
fix: Destroy the node http server response stream if there was a caught error (#12333)
This commit is contained in:
parent
5f7bf49d38
commit
836cd91c37
2 changed files with 9 additions and 2 deletions
5
.changeset/clean-plums-tap.md
Normal file
5
.changeset/clean-plums-tap.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Destroy the server response stream if async error is thrown
|
|
@ -153,8 +153,10 @@ export class NodeApp extends App {
|
|||
}
|
||||
destination.end();
|
||||
// the error will be logged by the "on end" callback above
|
||||
} catch {
|
||||
destination.end('Internal server error');
|
||||
} catch (err) {
|
||||
destination.write('Internal server error', () => {
|
||||
err instanceof Error ? destination.destroy(err) : destination.destroy();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue