Comparing version 1.0.0-rc4 to 1.0.0
/* eslint-env browser */ | ||
module.exports = FormData; | ||
module.exports = window.FormData; |
@@ -165,3 +165,3 @@ var CombinedStream = require('combined-stream'); | ||
// (e.g. to handle extra CRLFs on .NET servers) | ||
if (options.header) { | ||
if (typeof options.header == 'string') { | ||
return options.header; | ||
@@ -181,6 +181,25 @@ } | ||
// allow custom headers. | ||
if (typeof options.header == 'object') { | ||
populate(headers, options.header); | ||
} | ||
var header; | ||
for (var prop in headers) { | ||
if (headers[prop].length) { | ||
contents += prop + ': ' + headers[prop].join('; ') + FormData.LINE_BREAK; | ||
header = headers[prop]; | ||
// skip nullish headers. | ||
if (header == null) { | ||
continue; | ||
} | ||
// 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; | ||
} | ||
} | ||
@@ -197,3 +216,4 @@ | ||
// fs- and request- streams have path property | ||
var filename = options.filename || value.path; | ||
// formidable and the browser add a name property. | ||
var filename = options.filename || value.name || value.path; | ||
@@ -217,2 +237,7 @@ // or try http response | ||
// or try `name` from formidable, browser | ||
if (!contentType && value.name) { | ||
contentType = mime.lookup(value.name); | ||
} | ||
// or try `path` from fs-, request- streams | ||
@@ -273,2 +298,3 @@ if (!contentType && value.path) { | ||
// TODO: Looks like unused function | ||
FormData.prototype.getCustomHeaders = function(contentType) { | ||
@@ -275,0 +301,0 @@ contentType = contentType ? contentType : 'multipart/form-data'; |
// populates missing values | ||
module.exports = function(dst, src) { | ||
for (var prop in src) { | ||
if (src.hasOwnProperty(prop) && !dst[prop]) { | ||
dst[prop] = src[prop]; | ||
} | ||
} | ||
Object.keys(src).forEach(function(prop) | ||
{ | ||
dst[prop] = dst[prop] || src[prop]; | ||
}); | ||
return dst; | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.", | ||
"version": "1.0.0-rc4", | ||
"version": "1.0.0", | ||
"repository": { | ||
@@ -15,4 +15,4 @@ "type": "git", | ||
"pretest": "rimraf coverage test/tmp", | ||
"test": "istanbul cover --report none test/run.js", | ||
"posttest": "istanbul report", | ||
"test": "istanbul cover test/run.js", | ||
"posttest": "istanbul report lcov text", | ||
"lint": "eslint lib/*.js test/*.js test/**/*.js", | ||
@@ -22,3 +22,8 @@ "predebug": "rimraf coverage test/tmp", | ||
"check": "istanbul check-coverage coverage/coverage*.json", | ||
"coverage": "codacy-coverage < ./coverage/lcov.info; true" | ||
"files": "pkgfiles --sort=name", | ||
"get-version": "node -e \"console.log(require('./package.json').version)\"", | ||
"update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md", | ||
"restore-readme": "mv README.md.bak README.md", | ||
"prepublish": "in-publish && npm run update-readme || not-in-publish", | ||
"postpublish": "npm run restore-readme" | ||
}, | ||
@@ -34,20 +39,21 @@ "pre-commit": [ | ||
"dependencies": { | ||
"async": "^1.5.2", | ||
"async": "^2.0.1", | ||
"combined-stream": "^1.0.5", | ||
"mime-types": "^2.1.10" | ||
"mime-types": "^2.1.11" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"codacy-coverage": "^1.1.3", | ||
"coveralls": "^2.11.8", | ||
"cross-spawn": "^2.1.5", | ||
"eslint": "^2.4.0", | ||
"coveralls": "^2.11.12", | ||
"cross-spawn": "^4.0.0", | ||
"eslint": "^2.13.1", | ||
"fake": "^0.2.2", | ||
"far": "^0.0.7", | ||
"formidable": "^1.0.17", | ||
"istanbul": "^0.4.2", | ||
"pre-commit": "^1.1.2", | ||
"request": "^2.69.0", | ||
"rimraf": "^2.5.2" | ||
} | ||
"in-publish": "^2.0.0", | ||
"istanbul": "^0.4.5", | ||
"pkgfiles": "^2.3.0", | ||
"pre-commit": "^1.1.3", | ||
"request": "^2.74.0", | ||
"rimraf": "^2.5.4" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -10,8 +10,7 @@ # Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) | ||
[![Linux Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=linux:0.10-5.x)](https://travis-ci.org/form-data/form-data) | ||
[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/master.svg?label=windows:0.10-5.x)](https://ci.appveyor.com/project/alexindigo/form-data) | ||
[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/master.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) | ||
[![Linux Build](https://img.shields.io/travis/form-data/form-data/v1.0.0.svg?label=linux:0.10-6.x)](https://travis-ci.org/form-data/form-data) | ||
[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/v1.0.0.svg?label=windows:0.10-6.x)](https://ci.appveyor.com/project/alexindigo/form-data) | ||
[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v1.0.0.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) | ||
[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) | ||
[![Codacy Badge](https://img.shields.io/codacy/43ece80331c246179695e41f81eeffe2.svg)](https://www.codacy.com/app/form-data/form-data) | ||
[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data) | ||
@@ -22,3 +21,3 @@ | ||
``` | ||
npm install form-data | ||
npm install --save form-data | ||
``` | ||
@@ -216,6 +215,6 @@ | ||
- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. | ||
- If it feels like FormData hangs after submit and you're on ```node-0.10```, please check [Compatibility with Older Node Versions][streams2-thing] | ||
- If it feels like FormData hangs after submit, please check [Compatibility with Older Node Versions][streams2-thing] | ||
## License | ||
Form-Data is licensed under the MIT license. | ||
Form-Data is released under the [MIT](License) license. |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
27750
357
1
12
7
218
+ Addedasync@2.6.4(transitive)
+ Addedlodash@4.17.21(transitive)
- Removedasync@1.5.2(transitive)
Updatedasync@^2.0.1
Updatedmime-types@^2.1.11