fixed ie11 upload error

master
Haluk Keskin 8 years ago
parent 453a1a574d
commit ea3767df64

1
.gitignore vendored

@ -1,3 +1,4 @@
.DS_Store
node_modules/
npm-debug.log
.idea

@ -1,6 +1,6 @@
/*!
* Name: vue-upload-component
* Version: 2.8.2
* Version: 2.8.5
* Author: LianYue
*/
(function (global, factory) {
@ -16,8 +16,8 @@
*/
var createRequest = function createRequest(options) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.open(options.method || 'GET', options.url);
xhr.responseType = 'json';
if (options.headers) {
Object.keys(options.headers).forEach(function (key) {
xhr.setRequestHeader(key, options.headers[key]);
@ -37,7 +37,13 @@ var sendRequest = function sendRequest(xhr, body) {
return new Promise(function (resolve, reject) {
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response);
var response;
try {
response = JSON.parse(xhr.response);
} catch (err) {
response = xhr.response;
}
resolve(response);
} else {
reject(xhr.response);
}
@ -64,7 +70,13 @@ var sendFormRequest = function sendFormRequest(xhr, data) {
return new Promise(function (resolve, reject) {
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response);
var response;
try {
response = JSON.parse(xhr.response);
} catch (err) {
response = xhr.response;
}
resolve(response);
} else {
reject(xhr.response);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
/*!
* Name: vue-upload-component
* Version: 2.8.2
* Version: 2.8.5
* Author: LianYue
*/
(function (global, factory) {
@ -16,8 +16,8 @@
*/
var createRequest = function createRequest(options) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.open(options.method || 'GET', options.url);
xhr.responseType = 'json';
if (options.headers) {
Object.keys(options.headers).forEach(function (key) {
xhr.setRequestHeader(key, options.headers[key]);
@ -37,7 +37,13 @@ var sendRequest = function sendRequest(xhr, body) {
return new Promise(function (resolve, reject) {
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response);
var response;
try {
response = JSON.parse(xhr.response);
} catch (err) {
response = xhr.response;
}
resolve(response);
} else {
reject(xhr.response);
}
@ -64,7 +70,13 @@ var sendFormRequest = function sendFormRequest(xhr, data) {
return new Promise(function (resolve, reject) {
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response);
var response;
try {
response = JSON.parse(xhr.response);
} catch (err) {
response = xhr.response;
}
resolve(response);
} else {
reject(xhr.response);
}

File diff suppressed because one or more lines are too long

20
docs/dist/index.js vendored

@ -1,6 +1,6 @@
/*!
* Name: vue-upload-component
* Version: 2.8.2
* Version: 2.8.5
* Author: LianYue
*/
/******/ (function(modules) { // webpackBootstrap
@ -4883,8 +4883,8 @@ var ChunkUploadHandler = function () {
*/
var createRequest = function createRequest(options) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.open(options.method || 'GET', options.url);
xhr.responseType = 'json';
if (options.headers) {
Object.keys(options.headers).forEach(function (key) {
xhr.setRequestHeader(key, options.headers[key]);
@ -4904,7 +4904,13 @@ var sendRequest = function sendRequest(xhr, body) {
return new Promise(function (resolve, reject) {
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response);
var response;
try {
response = JSON.parse(xhr.response);
} catch (err) {
response = xhr.response;
}
resolve(response);
} else {
reject(xhr.response);
}
@ -4931,7 +4937,13 @@ var sendFormRequest = function sendFormRequest(xhr, data) {
return new Promise(function (resolve, reject) {
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response);
var response;
try {
response = JSON.parse(xhr.response);
} catch (err) {
response = xhr.response;
}
resolve(response);
} else {
reject(xhr.response);
}

File diff suppressed because one or more lines are too long

2
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "vue-upload-component",
"version": "2.8.4",
"version": "2.8.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

@ -5,8 +5,8 @@
*/
export const createRequest = (options) => {
const xhr = new XMLHttpRequest()
xhr.responseType = 'json'
xhr.open(options.method || 'GET', options.url)
xhr.responseType = 'json'
if (options.headers) {
Object.keys(options.headers).forEach(key => {
xhr.setRequestHeader(key, options.headers[key])
@ -26,7 +26,13 @@ export const sendRequest = (xhr, body) => {
return new Promise((resolve, reject) => {
xhr.onload = () => {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response)
var response
try {
response = JSON.parse(xhr.response)
} catch (err) {
response = xhr.response
}
resolve(response)
} else {
reject(xhr.response)
}
@ -51,7 +57,13 @@ export const sendFormRequest = (xhr, data) => {
return new Promise((resolve, reject) => {
xhr.onload = () => {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.response)
var response
try {
response = JSON.parse(xhr.response)
} catch (err) {
response = xhr.response
}
resolve(response)
} else {
reject(xhr.response)
}

Loading…
Cancel
Save