From 812f2e4c22182fdbaf783dba3cc9d178783eced7 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 17 May 2024 14:35:19 +0200 Subject: fix: serve handler error with 0 arguments (#23652) Fixes https://github.com/denoland/deno/issues/23651 Co-authored-by: Satya Rohith --- ext/http/00_serve.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/http/00_serve.ts') diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index b12a87390..de94779dc 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -793,9 +793,9 @@ internals.serveHttpOnConnection = serveHttpOnConnection; function registerDeclarativeServer(exports) { if (ObjectHasOwn(exports, "fetch")) { - if (typeof exports.fetch !== "function" || exports.fetch.length !== 1) { + if (typeof exports.fetch !== "function") { throw new TypeError( - "Invalid type for fetch: must be a function with a single parameter", + "Invalid type for fetch: must be a function with a single or no parameter", ); } return ({ servePort, serveHost }) => { -- cgit v1.2.3