Skip to content

Commit a0e89a4

Browse files
committed
Remove type check on options.type
1 parent 46219a6 commit a0e89a4

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Controls the maximum request body size. If this is a number, then the value spec
6767

6868
#### type
6969

70-
The expected `Content-Type` of the XML request to be parsed. Overrides the default content types, can be a String or Array of Strings.
70+
The type option is used to determine what media type the middleware will parse. This option can be a string, array of strings, or a function. If not a function, type option is passed directly to the type-is library and this can be an extension name (like xml), a mime type (like application/xml), or a mime type with a wildcard (like */* or */xml). If a function, the type option is called as fn(req) and the request is parsed if it returns a truthy value. Defaults to `['*/xml', '+xml']`.
7171

7272
#### verify
7373

index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ module.exports = function(bodyParser) {
1515
options = options || {};
1616

1717
options.type = options.type || DEFAULT_TYPES;
18-
if(typeof options.type !== 'function' && !Array.isArray(options.type)) {
19-
options.type = [options.type];
20-
}
2118

2219
var textParser = bodyParser.text(options);
2320
return function xmlParser(req, res, next) {

0 commit comments

Comments
 (0)