parent
c71209507b
commit
606e66beb3
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,12 @@
|
|||
//= require ohauth
|
||||
|
||||
$(document).ready(function () {
|
||||
function makeAbsolute(url) {
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
return a.href;
|
||||
}
|
||||
|
||||
if (OSM.oauth_token) {
|
||||
var headerGenerator = window.ohauth.headerGenerator({
|
||||
consumer_key: OSM.oauth_consumer_key,
|
||||
|
@ -12,7 +18,7 @@ $(document).ready(function () {
|
|||
$.ajaxPrefilter(function(options, jqxhr) {
|
||||
if (options.oauth) {
|
||||
options.headers = options.headers || {};
|
||||
options.headers.Authorization = headerGenerator(options.type, options.url, jqxhr.data);
|
||||
options.headers.Authorization = headerGenerator(options.type, makeAbsolute(options.url), jqxhr.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue