Unverified Commit 8fb123f9 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #1562 from hypothesis/remove-client-version-header-from-static-api-requests

Remove Hypothesis-Client-Version header from "trivial" API requests
parents 3ee92e97 fbeac25d
......@@ -14,12 +14,11 @@ function apiRoutes(settings) {
let linkCache;
function getJSON(url) {
const config = {
headers: {
'Hypothesis-Client-Version': '__VERSION__', // replaced by versionify
},
};
return fetch(url, config).then(response => {
// nb. The `/api/` and `/api/links` routes are fetched without specifying
// any additional headers/config so that we can use `<link rel="preload">` in
// the `/app.html` response to fetch them early, while the client JS app
// is loading.
return fetch(url).then(response => {
if (response.status !== 200) {
throw new Error(`Fetching ${url} failed`);
}
......
......@@ -91,14 +91,6 @@ describe('sidebar.api-routes', () => {
assert.deepEqual(routes, apiIndexResponse.links);
});
});
it('sends client version custom request header', () => {
return apiRoutes.routes().then(() => {
assert.calledWith(window.fetch, fakeSettings.apiUrl, {
headers: { 'Hypothesis-Client-Version': '__VERSION__' },
});
});
});
});
describe('#links', () => {
......
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