Comparing version 4.2.2 to 4.3.0
@@ -45,7 +45,3 @@ 'use strict'; | ||
this.result = {}; | ||
this.next = (err) => { | ||
return next(err, this.result); | ||
}; | ||
this.next = (err) => next(err, this.result); | ||
}; | ||
@@ -130,2 +126,6 @@ | ||
if (this.result.contentType.mime === 'multipart/form-data') { | ||
if (this.settings.multipart === false) { // Defaults to true | ||
return next(Boom.unsupportedMediaType()); | ||
} | ||
return this.multipart(source, contentType); | ||
@@ -165,3 +165,3 @@ } | ||
internals.object(payload, this.result.contentType.mime, this.settings, (err, result) => { | ||
internals.object(payload, this.result.contentType.mime, (err, result) => { | ||
@@ -249,3 +249,3 @@ if (err) { | ||
internals.object = function (payload, mime, options, next) { | ||
internals.object = function (payload, mime, next) { | ||
@@ -358,5 +358,7 @@ // Binary | ||
const output = (this.settings.multipart ? this.settings.multipart.output : this.settings.output); | ||
const onPart = (part) => { | ||
if (this.settings.output === 'file') { // Output: 'file' | ||
if (output === 'file') { // Output: 'file' | ||
const id = nextId++; | ||
@@ -393,3 +395,3 @@ pendingFiles[id] = true; | ||
if (this.settings.output === 'stream') { // Output: 'stream' | ||
if (output === 'stream') { // Output: 'stream' | ||
const item = Wreck.toReadableStream(payload); | ||
@@ -407,15 +409,13 @@ | ||
const mime = ct.split(';')[0].trim().toLowerCase(); | ||
const annotate = (value) => set(part.name, output === 'annotated' ? { filename: part.filename, headers: part.headers, payload: value } : value); | ||
if (!mime) { | ||
return set(part.name, payload); | ||
return annotate(payload); | ||
} | ||
if (!payload.length) { | ||
return set(part.name, {}); | ||
return annotate({}); | ||
} | ||
internals.object(payload, mime, this.settings, (err, result) => { | ||
return set(part.name, err ? payload : result); | ||
}); | ||
internals.object(payload, mime, (err, result) => annotate(err ? payload : result)); | ||
}); | ||
@@ -427,7 +427,4 @@ } | ||
const onField = (name, value) => { | ||
const onField = (name, value) => set(name, value); | ||
set(name, value); | ||
}; | ||
dispenser.on('field', onField); | ||
@@ -434,0 +431,0 @@ |
{ | ||
"name": "subtext", | ||
"description": "HTTP payload parsing", | ||
"version": "4.2.2", | ||
"version": "4.3.0", | ||
"repository": "git://github.com/hapijs/subtext", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
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
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
16202
335