Commit 46331600 authored by Hannah Stepanek's avatar Hannah Stepanek

Add client version request header to api calls

parent 39d3406b
......@@ -14,7 +14,12 @@ function apiRoutes($http, settings) {
let linkCache;
function getJSON(url) {
return $http.get(url).then(({ status, data }) => {
const config = {
headers: {
'Hypothesis-Client-Version': '__VERSION__', // replaced by versionify
},
};
return $http.get(url, config).then(({ status, data }) => {
if (status !== 200) {
throw new Error(`Fetching ${url} failed`);
}
......
......@@ -143,7 +143,9 @@ function createAPICall($http, $q, links, route, tokenGetter) {
.then(([links, token]) => {
const descriptor = get(links, route);
const url = urlUtil.replaceURLParams(descriptor.url, params);
const headers = {};
const headers = {
'Hypothesis-Client-Version': '__VERSION__', // replaced by versionify
};
accessToken = token;
if (token) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment