🔧 npm update

This commit is contained in:
2025-04-15 20:50:11 +02:00
parent ce5b9ac0c8
commit 94a90edabd
828 changed files with 256807 additions and 197099 deletions

View File

@@ -8,6 +8,7 @@ var fs = require('fs');
var Stream = require('stream').Stream;
var mime = require('mime-types');
var asynckit = require('asynckit');
var setToStringTag = require('es-set-tostringtag');
var populate = require('./populate.js');
// Public API
@@ -61,7 +62,7 @@ FormData.prototype.append = function(field, value, options) {
}
// https://github.com/felixge/node-form-data/issues/38
if (util.isArray(value)) {
if (Array.isArray(value)) {
// Please convert your array into string
// the way web server expects it
this._error(new Error('Arrays are not supported.'));
@@ -102,7 +103,7 @@ FormData.prototype._trackLength = function(header, value, options) {
FormData.LINE_BREAK.length;
// 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))) {
if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream))) {
return;
}
@@ -113,8 +114,7 @@ FormData.prototype._trackLength = function(header, value, options) {
};
FormData.prototype._lengthRetriever = function(value, callback) {
if (value.hasOwnProperty('fd')) {
if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
// take read range into a account
// `end` = Infinity > read file till the end
@@ -149,11 +149,11 @@ FormData.prototype._lengthRetriever = function(value, callback) {
}
// or http response
} else if (value.hasOwnProperty('httpVersion')) {
} else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
callback(null, +value.headers['content-length']);
// or request stream http://github.com/mikeal/request
} else if (value.hasOwnProperty('httpModule')) {
} else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
// wait till response come back
value.on('response', function(response) {
value.pause();
@@ -193,22 +193,23 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
var header;
for (var prop in headers) {
if (!headers.hasOwnProperty(prop)) continue;
header = headers[prop];
if (Object.prototype.hasOwnProperty.call(headers, prop)) {
header = headers[prop];
// skip nullish headers.
if (header == null) {
continue;
}
// skip nullish headers.
if (header == null) {
continue;
}
// convert all headers to arrays.
if (!Array.isArray(header)) {
header = [header];
}
// convert all headers to arrays.
if (!Array.isArray(header)) {
header = [header];
}
// add non-empty headers.
if (header.length) {
contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
// add non-empty headers.
if (header.length) {
contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
}
}
}
@@ -229,7 +230,7 @@ FormData.prototype._getContentDisposition = function(value, options) {
// formidable and the browser add a name property
// fs- and request- streams have path property
filename = path.basename(options.filename || value.name || value.path);
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
} else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
// or try http response
filename = path.basename(value.client._httpMessage.path || '');
}
@@ -257,7 +258,7 @@ FormData.prototype._getContentType = function(value, options) {
}
// or if it's http-reponse
if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
contentType = value.headers['content-type'];
}
@@ -298,7 +299,7 @@ FormData.prototype.getHeaders = function(userHeaders) {
};
for (header in userHeaders) {
if (userHeaders.hasOwnProperty(header)) {
if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
formHeaders[header.toLowerCase()] = userHeaders[header];
}
}
@@ -319,7 +320,7 @@ FormData.prototype.getBoundary = function() {
};
FormData.prototype.getBuffer = function() {
var dataBuffer = new Buffer.alloc( 0 );
var dataBuffer = new Buffer.alloc(0);
var boundary = this.getBoundary();
// Create the form content. Add Line breaks to the end of data.
@@ -499,3 +500,4 @@ FormData.prototype._error = function(err) {
FormData.prototype.toString = function () {
return '[object FormData]';
};
setToStringTag(FormData, 'FormData');