1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-03 20:30:04 +02:00

update packages to latest version

This commit is contained in:
s2
2022-08-20 18:51:33 +02:00
parent 09663a35a5
commit 806ebf9a57
4513 changed files with 366205 additions and 92512 deletions

View File

@@ -5,6 +5,7 @@ var http = require('http');
var https = require('https');
var parseUrl = require('url').parse;
var fs = require('fs');
var Stream = require('stream').Stream;
var mime = require('mime-types');
var asynckit = require('asynckit');
var populate = require('./populate.js');
@@ -100,8 +101,8 @@ FormData.prototype._trackLength = function(header, value, options) {
Buffer.byteLength(header) +
FormData.LINE_BREAK.length;
// empty or either doesn't have path or not an http response
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
// empty or either doesn't have path or not an http response or not a stream
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) {
return;
}
@@ -456,13 +457,15 @@ FormData.prototype.submit = function(params, cb) {
// get content length and fire away
this.getLength(function(err, length) {
if (err) {
if (err && err !== 'Unknown stream') {
this._error(err);
return;
}
// add content length
request.setHeader('Content-Length', length);
if (length) {
request.setHeader('Content-Length', length);
}
this.pipe(request);
if (cb) {