Fixed authoriser empty response
This commit is contained in:
parent
57773cfd66
commit
24d82a5768
@ -201,6 +201,10 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
|
|||||||
responseType: 'arraybuffer',
|
responseType: 'arraybuffer',
|
||||||
transformRequest: null,
|
transformRequest: null,
|
||||||
transformResponse: function (responseBuffer) {
|
transformResponse: function (responseBuffer) {
|
||||||
|
if (!responseBuffer || !responseBuffer.byteLength) {
|
||||||
|
return $q.reject({code: 406, type: 'NETWORK_BAD_RESPONSE'});
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
var deserializer = new TLDeserialization(responseBuffer, {mtproto: true});
|
var deserializer = new TLDeserialization(responseBuffer, {mtproto: true});
|
||||||
@ -216,20 +220,12 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
|
|||||||
|
|
||||||
return deserializer;
|
return deserializer;
|
||||||
}
|
}
|
||||||
}).then(
|
})['catch'](function (error) {
|
||||||
function (result) {
|
if (!error.message && !error.type) {
|
||||||
if (!result.data || !result.data.byteLength) {
|
error = {code: 406, type: 'NETWORK_BAD_REQUEST'};
|
||||||
return $q.reject({code: 406, type: 'NETWORK_BAD_REQUEST'});
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
function (error) {
|
|
||||||
if (!error.message && !error.type) {
|
|
||||||
error = {code: 406, type: 'NETWORK_BAD_REQUEST'};
|
|
||||||
}
|
|
||||||
return $q.reject(error);
|
|
||||||
}
|
}
|
||||||
);
|
return $q.reject(error);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function mtpSendReqPQ (auth) {
|
function mtpSendReqPQ (auth) {
|
||||||
@ -1130,7 +1126,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
|
|||||||
}).then(
|
}).then(
|
||||||
function (result) {
|
function (result) {
|
||||||
if (!result.data || !result.data.byteLength) {
|
if (!result.data || !result.data.byteLength) {
|
||||||
return $q.reject({code: 406, type: 'NETWORK_BAD_REQUEST'});
|
return $q.reject({code: 406, type: 'NETWORK_BAD_RESPONSE'});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user