Skip to content

Commit

Permalink
fix(server): set an empty object for server context if nothing is sen…
Browse files Browse the repository at this point in the history
…t by the env
  • Loading branch information
ardatan committed Sep 19, 2022
1 parent 3bf4c6e commit 48bdf61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/heavy-sheep-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@whatwg-node/server': patch
---

Set an empty object if there is no server context sent by the environment
2 changes: 1 addition & 1 deletion packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function createServerAdapter<
event.respondWith(response$);
}

function genericRequestHandler(input: any, ctx: any, ...rest: any[]) {
function genericRequestHandler(input: any, ctx: any = {}, ...rest: any[]) {
if ('process' in globalThis && process.versions?.['bun'] != null) {
// This is required for bun
input.text();
Expand Down

0 comments on commit 48bdf61

Please sign in to comment.