mastercontroller 1.3.26 → 1.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/MasterRouter.js +6 -1
  2. package/package.json +1 -1
package/MasterRouter.js CHANGED
@@ -37,7 +37,9 @@ const HTTP_METHODS = {
37
37
  GET: 'get',
38
38
  POST: 'post',
39
39
  PUT: 'put',
40
+ PATCH: 'patch',
40
41
  DELETE: 'delete',
42
+ HEAD: 'head',
41
43
  OPTIONS: 'options'
42
44
  };
43
45
 
@@ -239,7 +241,10 @@ const ROUTER_CONFIG = {
239
241
  const pathObj = normalizePaths(requestObject.pathName, route.path, testParams);
240
242
 
241
243
  // if we find the route that matches the request
242
- if(pathObj.requestPath === pathObj.routePath && route.type === requestObject.type){
244
+ // HEAD requests match GET routes per HTTP spec (RFC 9110 §9.3.2)
245
+ const methodMatches = route.type === requestObject.type
246
+ || (requestObject.type === HTTP_METHODS.HEAD && route.type === HTTP_METHODS.GET);
247
+ if(pathObj.requestPath === pathObj.routePath && methodMatches){
243
248
  // Only commit the extracted params if this route actually matches
244
249
  requestObject.params = testParams;
245
250
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastercontroller",
3
- "version": "1.3.26",
3
+ "version": "1.3.27",
4
4
  "description": "Fortune 500 ready Node.js MVC framework with enterprise security, monitoring, and horizontal scaling",
5
5
  "main": "MasterControl.js",
6
6
  "license": "MIT",