From 3a955af1bc4dbaa2cbda1673c8b4251b4e7de07c Mon Sep 17 00:00:00 2001 From: Toby Date: Tue, 21 Feb 2023 15:45:12 +0100 Subject: [PATCH] fix cors edge case --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 1f2a699..84d7cb7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -429,8 +429,10 @@ export class Router { if (!response) return new Response(this.debugMode ? 'Handler did not return a Response!' : null, { status: 404 }) - if (this.corsEnabled) + if (this.corsEnabled) { + response = new Response(response.body, response) this.setCorsHeaders(response.headers) + } return response }