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',
|
||||
transformRequest: null,
|
||||
transformResponse: function (responseBuffer) {
|
||||
if (!responseBuffer || !responseBuffer.byteLength) {
|
||||
return $q.reject({code: 406, type: 'NETWORK_BAD_RESPONSE'});
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
var deserializer = new TLDeserialization(responseBuffer, {mtproto: true});
|
||||
@ -216,20 +220,12 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
|
||||
|
||||
return deserializer;
|
||||
}
|
||||
}).then(
|
||||
function (result) {
|
||||
if (!result.data || !result.data.byteLength) {
|
||||
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);
|
||||
})['catch'](function (error) {
|
||||
if (!error.message && !error.type) {
|
||||
error = {code: 406, type: 'NETWORK_BAD_REQUEST'};
|
||||
}
|
||||
);
|
||||
return $q.reject(error);
|
||||
});
|
||||
};
|
||||
|
||||
function mtpSendReqPQ (auth) {
|
||||
@ -1130,7 +1126,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
|
||||
}).then(
|
||||
function (result) {
|
||||
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;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user