Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-upload

Package Overview
Dependencies
Maintainers
3
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-upload - npm Package Compare versions

Comparing version 1.10.0 to 1.11.0

5

HISTORY.md
# History
----
### 1.11.0 2016-05-03
- Allow all 2xx status as success status, not only 200. fix #34
- When `headers['X-Requested-With'] = null` , request do not set X-Requested-With as XMLHttpRequest , fix #33
### 1.9.0 2016-03-23

@@ -5,0 +10,0 @@

26

lib/request.js

@@ -29,2 +29,14 @@ 'use strict';

// option {
// onProgress: (event: { percent: number }): void,
// onError: (event: Error, body?: Object): void,
// onSuccess: (body: Object): void,
// data: Object,
// filename: String,
// file: File,
// withCredentials: Boolean,
// action: String,
// headers: Object,
// }
function upload(option) {

@@ -60,3 +72,5 @@ if (typeof XMLHttpRequest === 'undefined') {

xhr.onload = function onload() {
if (xhr.status !== 200) {
// allow success when 2xx status
// see https://github.com/react-component/upload/issues/34
if (xhr.status < 200 || xhr.status >= 300) {
return option.onError(getError(option, xhr), getBody(xhr));

@@ -75,6 +89,12 @@ }

xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
var headers = option.headers || {};
// when set headers['X-Requested-With'] = null , can close default XHR header
// see https://github.com/react-component/upload/issues/33
if (headers['X-Requested-With'] !== null) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
for (var h in headers) {
if (headers.hasOwnProperty(h)) {
if (headers.hasOwnProperty(h) && headers[h] !== null) {
xhr.setRequestHeader(h, headers[h]);

@@ -81,0 +101,0 @@ }

2

lib/Upload.js

@@ -27,3 +27,2 @@ 'use strict';

propTypes: {
forceAjax: _react.PropTypes.bool,
action: _react.PropTypes.string,

@@ -49,3 +48,2 @@ name: _react.PropTypes.string,

name: 'file',
forceAjax: false,
multipart: false,

@@ -52,0 +50,0 @@ onProgress: empty,

{
"name": "rc-upload",
"version": "1.10.0",
"version": "1.11.0",
"description": "upload ui component for react",

@@ -23,3 +23,3 @@ "keywords": [

},
"licenses": "MIT",
"license": "MIT",
"files": [

@@ -51,3 +51,4 @@ "lib"

"react-addons-test-utils": "~0.14.0",
"react-dom": "0.14.x"
"react-dom": "0.14.x",
"sinon": "^1.17.3"
},

@@ -54,0 +55,0 @@ "pre-commit": [

@@ -61,3 +61,2 @@ # rc-upload

|accept | string | | input accept attribute |
|forceAjax | bool | | force to use ajax render. used for server render |
|multiple | boolean | false | only support ie10+|

@@ -64,0 +63,0 @@ |onStart | function| | start upload file |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc