Skip to content

Commit

Permalink
readd failover if server does not handle access-token via header
Browse files Browse the repository at this point in the history
  • Loading branch information
krombel committed Jul 1, 2017
1 parent 59160a5 commit 6bb6f99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/http-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ module.exports.MatrixHttpApi.prototype = {
const self = this;

requestPromise.catch(function(err) {
if (err.toString().indexOf("Error: CORS request rejected") != -1) {
if ((self.authorization_header_supported === undefined &&
err.errcode == 'M_UNKNOWN_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;
Expand Down

0 comments on commit 6bb6f99

Please sign in to comment.