Fix #224: responseType "arraybuffer" and "blob" not working on browser platform

This commit is contained in:
Sefa Ilkimen
2019-06-14 16:43:36 +02:00
parent d99c7bb154
commit 2b567cdf32
5 changed files with 24 additions and 3 deletions
+7
View File
@@ -236,6 +236,13 @@ module.exports = function init(jsUtil, cookieHandler, messages, base64) {
function injectRawResponseHandler(responseType, cb) {
return function (response) {
var dataType = jsUtil.getTypeOf(response.data);
// don't need post-processing if it's already binary type (on browser platform)
if (dataType === 'ArrayBuffer' || dataType === 'Blob') {
return cb(response);
}
// arraybuffer
if (responseType === validResponseTypes[1]) {
var buffer = base64.toArrayBuffer(response.data);