Skip to content

Instantly share code, notes, and snippets.

@IAfanasovMob
Created October 8, 2019 12:04
Show Gist options
  • Save IAfanasovMob/255c18ec2c8eebbc02328187cb342c8a to your computer and use it in GitHub Desktop.
Save IAfanasovMob/255c18ec2c8eebbc02328187cb342c8a to your computer and use it in GitHub Desktop.
it(`should add Accept header with value 'application/vnd.github.v3.star+json'
when requested https://api.github.com/*`, () => {
client.get('https://api.github.com/anything').subscribe();
const requests = httpMock.match({ method: 'get' });
expect(requests[0].request.headers.get('Accept'))
.toEqual('application/vnd.github.v3.star+json');
});
it(`should NOT add Accept header when requested NOT https://api.github.com/*`, () => {
client.get('https://not-a-github-api.com/anything').subscribe();
const requests = httpMock.match({ method: 'get' });
expect(requests[0].request.headers.has('Accept')).toEqual(false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment