method-override
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "method-override", | ||
"description": "method override", | ||
"version": "1.0.0", | ||
"description": "Override HTTP verbs", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -21,13 +21,14 @@ "name": "Jonathan Ong", | ||
"dependencies": { | ||
"methods": "*" | ||
"methods": "1.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^1.17.0", | ||
"should": "^3.0.0", | ||
"supertest": "*", | ||
"connect": "*" | ||
"mocha": "~1.18.2", | ||
"supertest": "~0.12.1" | ||
}, | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
}, | ||
"scripts": { | ||
"test": "make test" | ||
"test": "mocha --reporter spec" | ||
} | ||
} |
@@ -1,11 +0,45 @@ | ||
# Method Override | ||
# method-override [![Build Status](https://travis-ci.org/expressjs/method-override.svg)](https://travis-ci.org/expressjs/method-override) [![NPM version](https://badge.fury.io/js/method-override.svg)](http://badge.fury.io/js/method-override) | ||
Lets you use HTTP verbs such as PUT or DELETE in places you normally can't. | ||
Previously `connect.methodOverride()`. | ||
Usage: | ||
## Install | ||
```sh | ||
$ npm install method-override | ||
``` | ||
## API | ||
**NOTE** It is very important that this module is used **before** any module that | ||
needs to know the method of the request (for example, it _must_ be used prior to | ||
the `csurf` module). | ||
### methodOverride(key) | ||
Create a new middleware function to override the `req.method` property with a new | ||
value. This value will be pulled from the `X-HTTP-Method-Override` header of the | ||
request. If this header is not present, then this module will look in the `req.body` | ||
object for a property name given by the `key` argument (and if found, will delete | ||
the property from `req.body`). | ||
If the found method is supported by node.js core, then `req.method` will be set to | ||
this value, as if it has originally been that value. The previous `req.method` | ||
value will be stored in `req.originalMethod`. | ||
#### key | ||
This is the property to look for the overwritten method in the `req.body` object. | ||
This defaults to `"_method"`. | ||
## Examples | ||
```js | ||
var app = require('connect'); | ||
app.use(require('body-parser')()); | ||
app.use(require('method-override')()) | ||
var bodyParser = require('body-parser') | ||
var connect = require('connect') | ||
var methodOverride = require('method-override') | ||
app.use(bodyParser()) | ||
app.use(methodOverride()) | ||
``` | ||
@@ -12,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
4744
2
0
70
5
1
+ Addedmethods@1.0.0(transitive)
- Removedmethods@1.1.2(transitive)
Updatedmethods@1.0.0