diff --git a/README.md b/README.md index 6e513bf..4cbb206 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,6 @@ Key | Type | Description `params` | `object` | Object containing all parameters defined in the url string `query` | `object` | Object containing all query parameters - ### `res`-Object Key | Type | Description diff --git a/index.js b/index.js index ef2452f..6de9333 100644 --- a/index.js +++ b/index.js @@ -323,7 +323,9 @@ class Router { method: request.method, headers: request.headers, url: request.url, - params: [] + params: [], + query: {}, + body: '' } if (req.method === 'OPTIONS' && Object.keys(this.corsConfig).length) { return new Response(null, { @@ -336,7 +338,7 @@ class Router { status: this.corsConfig.optionsSuccessStatus }) } - if (['POST', 'PUT', 'PATCH', 'DELETE'].includes(req.method)) { + if (['POST', 'PUT', 'PATCH'].includes(req.method)) { if (req.headers.has('Content-Type') && req.headers.get('Content-Type').includes('json')) { try { req.body = await request.json() diff --git a/package.json b/package.json index af7e444..30a1ef2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tsndr/cloudflare-worker-router", - "version": "1.2.2", + "version": "1.2.3", "description": "", "main": "index.js", "scripts": {},