Skip to content

Commit

Permalink
lib: using type-is; all http verbs supported
Browse files Browse the repository at this point in the history
  • Loading branch information
tmarshall authored and jpfluger committed Oct 19, 2014
1 parent 4b03d9e commit c8ba4f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var path = require('path');
var crypto = require('crypto');
var Busboy = require('busboy');
var mkdirp = require('mkdirp');
var is = require('type-is');
var qs = require('qs');

module.exports = function(options) {
Expand Down Expand Up @@ -38,11 +39,7 @@ module.exports = function(options) {
req.body = req.body || {};
req.files = req.files || {};

if (req.headers['content-type'] &&
req.headers['content-type'].indexOf('multipart/form-data') === 0 &&
(req.method === 'POST' || req.method === 'PUT' || req.method === 'PATCH')
) {

if (is(req, ['multipart'])) {
if (options.onParseStart) { options.onParseStart(); }

// add the request headers to the options
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"dependencies": {
"busboy": "~0.2.9",
"mkdirp": "~0.3.5",
"qs": "~1.2.2"
"qs": "~1.2.2",
"type-is": "~1.5.2"
},
"devDependencies": {
"chai": "^1.9.1",
Expand Down

0 comments on commit c8ba4f4

Please sign in to comment.