diff --git a/index.js b/index.js index 532a29c..bcd388a 100644 --- a/index.js +++ b/index.js @@ -50,7 +50,7 @@ class Router { * @property {Object} params Object containing all parameters defined in the url string * @property {Object} query Object containing all query parameters * @property {Object} headers Object containing request headers - * @property {Object|string} body Only available if method is `POST`, `PUT` or `PATCH`. Contains either the received body string or a parsed object if valid JSON was sent. + * @property {Object|string} body Only available if method is `POST`, `PUT`, `PATCH` or `DELETE`. Contains either the received body string or a parsed object if valid JSON was sent. * @property {Object} cf object containing custom Cloudflare properties. (https://developers.cloudflare.com/workers/examples/accessing-the-cloudflare-object) */ @@ -314,7 +314,7 @@ class Router { status: this.corsConfig.optionsSuccessStatus }) } - if (['POST', 'PUT', 'PATCH'].includes(req.method)) { + if (['POST', 'PUT', 'PATCH', 'DELETE'].includes(req.method)) { if (req.headers.has('Content-Type') && req.headers.get('Content-Type').includes('json')) { try { req.body = await request.json()