1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

readd failover if server does not handle access-token via header

This commit is contained in:
Krombel
2017-07-01 14:30:37 +02:00
parent 59160a5d42
commit c6d2d4ccda
2 changed files with 4 additions and 2 deletions

View File

@@ -423,7 +423,8 @@ module.exports.MatrixHttpApi.prototype = {
const self = this;
requestPromise.catch(function(err) {
if (err.toString().indexOf("Error: CORS request rejected") != -1) {
if (err.errcode == 'M_MISSING_TOKEN' ||
err.toString().indexOf("Error: CORS request rejected") != -1) {
self.authorization_header_supported = false;
queryParams.access_token = opts.headers.Authorization.substr(7);
delete opts.headers.Authorization;
@@ -431,6 +432,7 @@ module.exports.MatrixHttpApi.prototype = {
callback, method, path, queryParams, data, opts,
);
requestPromise.abort = secondPromise.abort;
return secondPromise;
}
if (err.errcode == 'M_UNKNOWN_TOKEN') {
self.event_emitter.emit("Session.logged_out");