//= 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,
$.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);
}
});
}