Skip to content

Commit

Permalink
fix(sample): send correct headers to unicorn proxy
Browse files Browse the repository at this point in the history
Fixes #19

HTTP will be redirected if you use HTTPS Everywhere and Sindre's Unicorn Proxy
requires an X-Requested-With.
  • Loading branch information
passy committed Mar 17, 2014
1 parent 5a692bf commit 27cc217
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sample/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ module.factory('HALTalkResource', function HALTalkResource() {

// Configure Hyperagent to prefix every URL with the unicorn proxy.
Hyperagent.configure('ajax', function ajax(options) {
options.url = 'http://unicorn-cors-proxy.herokuapp.com/' + options.url;
options.url = 'https://unicorn-cors-proxy.herokuapp.com/' + options.url;

return jQuery.ajax(options);
});

return new Hyperagent.Resource({
url: 'http://haltalk.herokuapp.com/',
headers: {}
headers: {
'X-Requested-With': 'Hyperagent'
}
});
});

Expand Down

0 comments on commit 27cc217

Please sign in to comment.