Update to v1.1.9
This commit is contained in:
5
index.js
5
index.js
@@ -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),
|
||||||
|
|||||||
@@ -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": {},
|
||||||
|
|||||||
Reference in New Issue
Block a user