Skip to content

Commit

Permalink
Update for Basic auth bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-konshin committed Feb 20, 2015
1 parent eec28c9 commit 44f2017
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 48 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 RingCentral, Inc.
Copyright (c) 2014-2015 RingCentral, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,13 @@ Subscriptions are created by calling the `getSubscription` method of the RCSDK i
```js
var subscription = rcsdk.getSubscription();

subscription.on(this.subscription.events.notification, function(msg) {
subscription.on(subscription.events.notification, function(msg) {
console.log(msg, msg.body);
});

subscription.register({
events: ['/account/~/extension/~/presence'], // a list of server-side events
success: function(){ ... } // things to do on success
});
}).then(...);
```

Once a subscription has been created, the SDK takes care of renewing it automatically. To cancel a subscription, you can
Expand Down
27 changes: 10 additions & 17 deletions build/rc-sdk.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/rc-sdk.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/rc-sdk.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/rc-sdk.min.js.map

Large diffs are not rendered by default.

30 changes: 9 additions & 21 deletions lib/core/Ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ define(function(require, exports, module) {

Ajax.prototype.parseResponse = function() {

if (!this.isResponseMultipart()) {
try {

try {
if (!this.isResponseMultipart()) {

if (typeof(this.response) == 'string' && this.isResponseContentType(jsonContentType)) {

Expand All @@ -314,19 +314,7 @@ define(function(require, exports, module) {

if (!this.checkStatus(this.status)) this.error = new Error(this.data.message || this.data.error_description || this.data.description || 'Unknown error');

} catch (e) { // Capture parse errors

Log.error('Ajax.parseResponse(): Unable to parse data');
Log.error(e.stack || e);
Log.error(this.response);

this.error = e;

}

} else {

try {
} else {

var boundary = this.getResponseContentType().match(/boundary=([^;]+)/i)[1],
parts = this.response.split(boundarySeparator + boundary);
Expand Down Expand Up @@ -374,15 +362,15 @@ define(function(require, exports, module) {

}, this);

} catch (e) {
}

Log.error('Ajax.parseResponse(): Unable to parse batch response');
Log.error(e.stack || e);
Log.error(this.response);
} catch (e) { // Capture parse errors

this.error = e;
Log.error('Ajax.parseResponse(): Unable to parse data');
Log.error(e.stack || e);
Log.error(this.response);

}
this.error = e;

}

Expand Down
2 changes: 1 addition & 1 deletion lib/core/Platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ define(function(require, exports, module) {
.setOptions(options)
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
.setRequestHeader('Accept', 'application/json')
.setRequestHeader('Authorization', 'Basic' + this.apiKey)
.setRequestHeader('Authorization', 'Basic ' + this.apiKey)
.send();

};
Expand Down

0 comments on commit 44f2017

Please sign in to comment.