cross-undici-fetch
Advanced tools
Comparing version 0.4.2-alpha.3 to 0.4.2-alpha.4
@@ -7,3 +7,3 @@ const busboy = require('busboy'); | ||
const contentType = this.headers.get('Content-Type'); | ||
if (/multipart\/form-data/.test(contentType) && this.body) { | ||
@@ -23,5 +23,9 @@ const nodeReadable = this.body.on ? this.body : streams.Readable.from(this.body); | ||
reject(new Error(`File size limit exceeded: ${limits.fileSize}`)); | ||
}).on('data', (chunk) => { | ||
bb.end(); | ||
return; | ||
}) | ||
fileStream.on('data', (chunk) => { | ||
chunks.push(chunk); | ||
}).on('close', () => { | ||
}) | ||
fileStream.on('close', () => { | ||
formData.set(name, new File(chunks, filename, { type: mimeType })); | ||
@@ -33,5 +37,9 @@ }); | ||
reject(new Error(`Field name size exceeded: ${limits.fieldNameSize}`)); | ||
bb.end(); | ||
return; | ||
} | ||
if (valueTruncated) { | ||
reject(new Error(`Field value size exceeded: ${limits.fieldSize}`)); | ||
bb.end(); | ||
return; | ||
} | ||
@@ -42,8 +50,14 @@ formData.set(name, value) | ||
reject(new Error(`Parts limit exceeded: ${limits.parts}`)); | ||
bb.end(); | ||
return; | ||
}) | ||
bb.on('filesLimit', () => { | ||
reject(new Error(`Files limit exceeded: ${limits.files}`)); | ||
bb.end(); | ||
return; | ||
}) | ||
bb.on('fieldsLimit', () => { | ||
reject(new Error(`Fields limit exceeded: ${limits.fields}`)); | ||
bb.end(); | ||
return; | ||
}) | ||
@@ -50,0 +64,0 @@ bb.on('close', () => { |
{ | ||
"name": "cross-undici-fetch", | ||
"version": "0.4.2-alpha.3", | ||
"version": "0.4.2-alpha.4", | ||
"description": "Cross Platform Smart Fetch Ponyfill", | ||
@@ -5,0 +5,0 @@ "author": "Arda TANRIKULU <ardatanrikulu@gmail.com>", |
14766
355