Skip to content

fix IE 9- not support application/json #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions dist/qiniu.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* qiniu-js-sdk v1.0.16-beta
* qiniu-js-sdk v1.0.16.1-beta
*
* Copyright 2015 by Qiniu
* Released under GPL V2 License.
*
* GitHub: http://github.com/qiniu/js-sdk
*
* Date: 2016-5-31
* Date: 2016-7-12
*/

/*global plupload ,mOxie*/
Expand Down Expand Up @@ -626,13 +626,22 @@ function QiniuJsSDK() {
logger.debug("invoke reset_chunk_size()");
logger.debug("op.chunk_size: ", op.chunk_size);

// compose options with user passed options and default setting
plupload.extend(option, op, {
var defaultSetting = {
url: qiniuUploadUrl,
multipart_params: {
token: ''
}
});
};
var ie = that.detectIEVersion();
// case IE 9-
// add accept in multipart params
if (ie && ie <= 9) {
defaultSetting.multipart_params.accept = 'text/plain; charset=utf-8';
logger.debug("add accept text/plain in multipart params");
}

// compose options with user passed options and default setting
plupload.extend(option, op, defaultSetting);

logger.debug("option: ", option);

Expand Down Expand Up @@ -729,6 +738,13 @@ function QiniuJsSDK() {
'token': that.token
};
}
var ie = that.detectIEVersion();
// case IE 9-
// add accept in multipart params
if (ie && ie <= 9) {
multipart_params_obj.accept = 'text/plain; charset=utf-8';
logger.debug("add accept text/plain in multipart params");
}

logger.debug("directUpload multipart_params_obj: ", multipart_params_obj);

Expand Down Expand Up @@ -827,6 +843,14 @@ function QiniuJsSDK() {
}
}
speedCalInfo.startTime = new Date().getTime();
var multipart_params_obj = {};
var ie = that.detectIEVersion();
// case IE 9-
// add accept in multipart params
if (ie && ie <= 9) {
multipart_params_obj.accept = 'text/plain; charset=utf-8';
logger.debug("add accept text/plain in multipart params");
}
// TODO: to support bput
// http://developer.qiniu.com/docs/v6/api/reference/up/bput.html
up.setOption({
Expand All @@ -837,7 +861,7 @@ function QiniuJsSDK() {
'headers': {
'Authorization': 'UpToken ' + that.token
},
'multipart_params': {}
'multipart_params': multipart_params_obj
});
}
} else {
Expand Down
Loading