From 1d68898377acea7176765a2ed6a9dc5de96fe225 Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Tue, 18 Jan 2022 10:57:07 +0100 Subject: [PATCH] Update to v1.1.9 --- index.js | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7f9d761..b9e6815 100644 --- a/index.js +++ b/index.js @@ -61,6 +61,7 @@ class Router { * @property {Object} headers Object you can set response headers in * @property {number} status Return status code (default: `204`) * @property {Object | string} body Either an `object` (will be converted to JSON) or a string + * @property {Response} raw A response object that is to be returned, this will void all other res properties and return this as is. */ /** @@ -359,8 +360,8 @@ class Router { res.headers['Content-Type'] = 'application/json' res.body = JSON.stringify(res.body) } - if(res.response){ - return res.response + if (res.raw) { + return res.raw } return new Response(res.body, { status: res.status || (res.body ? 200 : 204), diff --git a/package.json b/package.json index e3e1b35..f8ceb9d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tsndr/cloudflare-worker-router", - "version": "1.1.8", + "version": "1.1.9", "description": "", "main": "index.js", "scripts": {},