Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

allow-methods

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

allow-methods - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

21

lib/allow-methods.js
'use strict';
const httpError = require('http-errors');
class MethodNotAllowedError extends Error {
/** @type {string} */
name = 'MethodNotAllowedError';
/** @type {number} */
status = 405;
/** @type {number} */
statusCode = 405;
}
/**

@@ -9,3 +20,3 @@ * Create an Express middleware function which errors if an HTTP method is not allowed.

* @public
* @param {Array<string>} [methods=[]]
* @param {string[]} [methods]
* The HTTP methods which will not throw 405 errors.

@@ -22,3 +33,3 @@ * @param {string} [message]

response.header('Allow', normalizedMethods.join(', '));
return next(httpError(405, message));
return next(new MethodNotAllowedError(message));
}

@@ -33,5 +44,5 @@ next();

* @private
* @param {Array<string>} methods
* @param {string[]} methods
* The HTTP methods to normalise.
* @returns {Array<string>}
* @returns {string[]}
* Returns an array of capitalised HTTP methods.

@@ -38,0 +49,0 @@ */

{
"name": "allow-methods",
"version": "5.0.1",
"version": "5.0.2",
"description": "Express/connect middleware to handle 405 errors",

@@ -39,12 +39,8 @@ "keywords": [

},
"dependencies": {
"http-errors": "^2.0.0"
},
"devDependencies": {
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@rowanmanning/eslint-config": "^6.0.0",
"@rowanmanning/eslint-config": "^7.0.0",
"@types/express": "^4.17.13",
"axios": "^1.0.0",
"chai": "^4.3.6",
"eslint": "^8.9.0",

@@ -70,2 +66,2 @@ "express4": "npm:express@^4.17.3",

}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc