Socket
Socket
Sign inDemoInstall

method-override

Package Overview
Dependencies
Maintainers
6
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

method-override - npm Package Compare versions

Comparing version 2.3.6 to 2.3.7

8

HISTORY.md

@@ -0,1 +1,9 @@

2.3.7 / 2016-11-19
==================
* deps: debug@2.3.3
- Fix error when running under React Native
- deps: ms@0.7.2
* perf: remove argument reassignment
2.3.6 / 2016-05-20

@@ -2,0 +10,0 @@ ==================

6

index.js

@@ -45,3 +45,3 @@ /*!

module.exports = function methodOverride (getter, options) {
options = options || {}
var opts = options || {}

@@ -54,5 +54,5 @@ // get the getter fn

// get allowed request methods to examine
var methods = options.methods === undefined
var methods = opts.methods === undefined
? ['POST']
: options.methods
: opts.methods

@@ -59,0 +59,0 @@ return function methodOverride (req, res, next) {

{
"name": "method-override",
"description": "Override HTTP verbs",
"version": "2.3.6",
"version": "2.3.7",
"contributors": [

@@ -12,3 +12,3 @@ "Douglas Christopher Wilson <doug@somethingdoug.com>",

"dependencies": {
"debug": "~2.2.0",
"debug": "2.3.3",
"methods": "~1.1.2",

@@ -19,8 +19,9 @@ "parseurl": "~1.3.1",

"devDependencies": {
"eslint": "2.10.2",
"eslint-config-standard": "5.3.1",
"eslint-plugin-promise": "1.1.0",
"eslint-plugin-standard": "1.3.2",
"istanbul": "0.4.3",
"mocha": "2.4.5",
"eslint": "3.9.1",
"eslint-config-standard": "6.2.1",
"eslint-plugin-markdown": "1.0.0-beta.3",
"eslint-plugin-promise": "3.3.1",
"eslint-plugin-standard": "2.0.1",
"istanbul": "0.4.5",
"mocha": "2.5.3",
"supertest": "1.1.0"

@@ -37,3 +38,3 @@ },

"scripts": {
"lint": "eslint **/*.js",
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --check-leaks --reporter spec --bail test/",

@@ -40,0 +41,0 @@ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/",

@@ -13,2 +13,6 @@ # method-override

This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh

@@ -68,4 +72,5 @@ $ npm install method-override

```js
var connect = require('connect')
var express = require('express')
var methodOverride = require('method-override')
var app = express()

@@ -78,2 +83,4 @@ // override with the X-HTTP-Method-Override header in the request

<!-- eslint-env browser -->
```js

@@ -86,3 +93,3 @@ var xhr = new XMLHttpRequest()

function onload() {
function onload () {
alert('got response: ' + this.responseText)

@@ -103,4 +110,5 @@ }

```js
var connect = require('connect')
var express = require('express')
var methodOverride = require('method-override')
var app = express()

@@ -122,4 +130,5 @@ // override with POST having ?_method=DELETE

```js
var connect = require('connect')
var express = require('express')
var methodOverride = require('method-override')
var app = express()

@@ -138,5 +147,6 @@ // override with different headers; last one takes precedence

```js
var bodyParser = require('body-parser')
var connect = require('connect')
var bodyParser = require('body-parser')
var express = require('express')
var methodOverride = require('method-override')
var app = express()

@@ -147,3 +157,3 @@ // NOTE: when using req.body, you must fully parse the request body

app.use(bodyParser.urlencoded())
app.use(methodOverride(function(req, res){
app.use(methodOverride(function (req, res) {
if (req.body && typeof req.body === 'object' && '_method' in req.body) {

@@ -150,0 +160,0 @@ // look in urlencoded POST bodies and delete it

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