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