讨论加特殊图标
This commit is contained in:
48
.output/server/node_modules/form-data/lib/form_data.js
generated
vendored
48
.output/server/node_modules/form-data/lib/form_data.js
generated
vendored
@@ -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');
|
||||
|
||||
49
.output/server/node_modules/form-data/package.json
generated
vendored
49
.output/server/node_modules/form-data/package.json
generated
vendored
@@ -2,7 +2,7 @@
|
||||
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
|
||||
"name": "form-data",
|
||||
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/form-data/form-data.git"
|
||||
@@ -11,13 +11,16 @@
|
||||
"browser": "./lib/browser",
|
||||
"typings": "./index.d.ts",
|
||||
"scripts": {
|
||||
"pretest": "rimraf coverage test/tmp",
|
||||
"test": "istanbul cover test/run.js",
|
||||
"posttest": "istanbul report lcov text",
|
||||
"lint": "eslint lib/*.js test/*.js test/integration/*.js",
|
||||
"pretest": "npm run lint",
|
||||
"pretests-only": "rimraf coverage test/tmp",
|
||||
"tests-only": "istanbul cover test/run.js",
|
||||
"posttests-only": "istanbul report lcov text",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npx npm@'>=10.2' audit --production",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"report": "istanbul report lcov text",
|
||||
"ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8",
|
||||
"ci-test": "npm run test && npm run browser && npm run report",
|
||||
"ci-test": "npm run tests-only && npm run browser && npm run report",
|
||||
"predebug": "rimraf coverage test/tmp",
|
||||
"debug": "verbose=1 ./test/run.js",
|
||||
"browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage",
|
||||
@@ -40,29 +43,35 @@
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"es-set-tostringtag": "^2.1.0",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.10",
|
||||
"browserify": "^13.1.1",
|
||||
"@types/combined-stream": "^1.0.6",
|
||||
"@types/mime-types": "^2.1.4",
|
||||
"@types/node": "^12.20.55",
|
||||
"browserify": "^13.3.0",
|
||||
"browserify-istanbul": "^2.0.0",
|
||||
"coveralls": "^3.0.4",
|
||||
"cross-spawn": "^6.0.5",
|
||||
"eslint": "^6.0.1",
|
||||
"coveralls": "^3.1.1",
|
||||
"cross-spawn": "^6.0.6",
|
||||
"eslint": "^6.8.0",
|
||||
"fake": "^0.2.2",
|
||||
"far": "^0.0.7",
|
||||
"formidable": "^1.0.17",
|
||||
"in-publish": "^2.0.0",
|
||||
"formidable": "^1.2.6",
|
||||
"in-publish": "^2.0.1",
|
||||
"is-node-modern": "^1.0.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"obake": "^0.1.2",
|
||||
"puppeteer": "^1.19.0",
|
||||
"pkgfiles": "^2.3.0",
|
||||
"pre-commit": "^1.1.3",
|
||||
"request": "^2.88.0",
|
||||
"pkgfiles": "^2.3.2",
|
||||
"pre-commit": "^1.2.2",
|
||||
"puppeteer": "^1.20.0",
|
||||
"request": "~2.87.0",
|
||||
"rimraf": "^2.7.1",
|
||||
"tape": "^4.6.2",
|
||||
"typescript": "^3.5.2"
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "^3.9.10"
|
||||
},
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"__npminstall_done": true,
|
||||
"_from": "form-data@4.0.2",
|
||||
"_resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.2.tgz"
|
||||
}
|
||||
Reference in New Issue
Block a user