1
0

Update to v1.1.9

This commit is contained in:
2022-01-18 10:57:07 +01:00
parent 059639603f
commit 1d68898377
2 changed files with 4 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ class Router {
* @property {Object<string, string>} headers Object you can set response headers in * @property {Object<string, string>} headers Object you can set response headers in
* @property {number} status Return status code (default: `204`) * @property {number} status Return status code (default: `204`)
* @property {Object<string, string> | string} body Either an `object` (will be converted to JSON) or a string * @property {Object<string, string> | 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.headers['Content-Type'] = 'application/json'
res.body = JSON.stringify(res.body) res.body = JSON.stringify(res.body)
} }
if(res.response){ if (res.raw) {
return res.response return res.raw
} }
return new Response(res.body, { return new Response(res.body, {
status: res.status || (res.body ? 200 : 204), status: res.status || (res.body ? 200 : 204),

View File

@@ -1,6 +1,6 @@
{ {
"name": "@tsndr/cloudflare-worker-router", "name": "@tsndr/cloudflare-worker-router",
"version": "1.1.8", "version": "1.1.9",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": {}, "scripts": {},