Commit 66067d72 authored by Hannah Stepanek's avatar Hannah Stepanek

Add tests to validate request header is sent

parent 46331600
......@@ -89,6 +89,14 @@ describe('sidebar.api-routes', () => {
assert.deepEqual(routes, apiIndexResponse.links);
});
});
it('sends client version custom request header', () => {
return apiRoutes.routes().then(() => {
assert.calledWith(fakeHttp.get, fakeSettings.apiUrl, {
headers: { 'Hypothesis-Client-Version': '__VERSION__' },
});
});
});
});
describe('#links', () => {
......
......@@ -364,4 +364,16 @@ describe('sidebar.services.api', function() {
.respond(() => [200, { userid: 'acct:user@example.com' }]);
$httpBackend.flush();
});
it('sends client version custom request header', () => {
api.profile.read({});
$httpBackend
.expectGET(
'https://example.com/api/profile',
headers => headers['Hypothesis-Client-Version'] === '__VERSION__'
)
.respond(() => [200, { userid: 'acct:user@example.com' }]);
$httpBackend.flush();
});
});
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