diff options
Diffstat (limited to 'ext/http')
-rw-r--r-- | ext/http/00_serve.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index 87798656f..6d23685d8 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -511,9 +511,15 @@ function mapToCallback(context, callback, onError) { ); } + if (response.type === "error") { + throw new TypeError( + "Return value from serve handler must not be an error response (like Response.error())", + ); + } + if (response.bodyUsed) { throw new TypeError( - "The body of the Response returned from the serve handler has already been consumed.", + "The body of the Response returned from the serve handler has already been consumed", ); } } catch (error) { |