Skip to content

Commit

Permalink
Merge pull request #58 from DracoBlue/fix-cors-credentials
Browse files Browse the repository at this point in the history
Allow credentials for CORS requests
  • Loading branch information
mikekelly committed Apr 14, 2015
2 parents b7669f1 + 80bad8b commit a2ee0f1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/hal/http/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ HAL.Http.Client.prototype.get = function(url) {
var jqxhr = $.ajax({
url: url,
dataType: 'json',
xhrFields: {
withCredentials: true
},
headers: this.defaultHeaders,
success: function(resource, textStatus, jqXHR) {
self.vent.trigger('response', {
Expand All @@ -25,6 +28,8 @@ HAL.Http.Client.prototype.get = function(url) {
HAL.Http.Client.prototype.request = function(opts) {
var self = this;
opts.dataType = 'json';
opts.xhrFields = opts.xhrFields || {};
opts.xhrFields.withCredentials = opts.xhrFields.withCredentials || true;
self.vent.trigger('location-change', { url: opts.url });
return jqxhr = $.ajax(opts);
};
Expand Down

0 comments on commit a2ee0f1

Please sign in to comment.