Skip to content

Commit

Permalink
Set connection: close HTTP request header when there is no request …
Browse files Browse the repository at this point in the history
…body

Fixes tests
  • Loading branch information
TooTallNate committed Aug 27, 2024
1 parent 7554cdf commit 49730f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/red-buses-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nxjs-runtime": patch
---

Set `connection: close` HTTP request header when there is no request body
2 changes: 1 addition & 1 deletion packages/runtime/src/fetch/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async function fetchHttp(req: Request, url: URL): Promise<Response> {
req.headers.set('accept', '*/*');
}

if (hasContentLength) {
if (!req.body || hasContentLength) {
req.headers.set('connection', 'close');
} else {
req.headers.set('connection', 'keep-alive');
Expand Down

0 comments on commit 49730f3

Please sign in to comment.