Skip to content

Commit 5ae51a6

Browse files
authored
Merge pull request #181 from codedogfish/ie
fix IE 9- not support application/json
2 parents d762f43 + 08c4962 commit 5ae51a6

File tree

5 files changed

+62
-14
lines changed

5 files changed

+62
-14
lines changed

dist/qiniu.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*!
2-
* qiniu-js-sdk v1.0.16-beta
2+
* qiniu-js-sdk v1.0.16.1-beta
33
*
44
* Copyright 2015 by Qiniu
55
* Released under GPL V2 License.
66
*
77
* GitHub: http://github.com/qiniu/js-sdk
88
*
9-
* Date: 2016-5-31
9+
* Date: 2016-7-12
1010
*/
1111

1212
/*global plupload ,mOxie*/
@@ -626,13 +626,22 @@ function QiniuJsSDK() {
626626
logger.debug("invoke reset_chunk_size()");
627627
logger.debug("op.chunk_size: ", op.chunk_size);
628628

629-
// compose options with user passed options and default setting
630-
plupload.extend(option, op, {
629+
var defaultSetting = {
631630
url: qiniuUploadUrl,
632631
multipart_params: {
633632
token: ''
634633
}
635-
});
634+
};
635+
var ie = that.detectIEVersion();
636+
// case IE 9-
637+
// add accept in multipart params
638+
if (ie && ie <= 9) {
639+
defaultSetting.multipart_params.accept = 'text/plain; charset=utf-8';
640+
logger.debug("add accept text/plain in multipart params");
641+
}
642+
643+
// compose options with user passed options and default setting
644+
plupload.extend(option, op, defaultSetting);
636645

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

@@ -729,6 +738,13 @@ function QiniuJsSDK() {
729738
'token': that.token
730739
};
731740
}
741+
var ie = that.detectIEVersion();
742+
// case IE 9-
743+
// add accept in multipart params
744+
if (ie && ie <= 9) {
745+
multipart_params_obj.accept = 'text/plain; charset=utf-8';
746+
logger.debug("add accept text/plain in multipart params");
747+
}
732748

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

@@ -827,6 +843,14 @@ function QiniuJsSDK() {
827843
}
828844
}
829845
speedCalInfo.startTime = new Date().getTime();
846+
var multipart_params_obj = {};
847+
var ie = that.detectIEVersion();
848+
// case IE 9-
849+
// add accept in multipart params
850+
if (ie && ie <= 9) {
851+
multipart_params_obj.accept = 'text/plain; charset=utf-8';
852+
logger.debug("add accept text/plain in multipart params");
853+
}
830854
// TODO: to support bput
831855
// http://developer.qiniu.com/docs/v6/api/reference/up/bput.html
832856
up.setOption({
@@ -837,7 +861,7 @@ function QiniuJsSDK() {
837861
'headers': {
838862
'Authorization': 'UpToken ' + that.token
839863
},
840-
'multipart_params': {}
864+
'multipart_params': multipart_params_obj
841865
});
842866
}
843867
} else {

0 commit comments

Comments
 (0)