Skip to content

Commit

Permalink
add failing test for isomorphic-fetch and matchHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Feb 9, 2017
1 parent d8b6d62 commit 26b2610
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_isomorphic_fetch.js
Expand Up @@ -76,3 +76,29 @@ test("basicAuth match works", function (t) {
throw err;
});
});

test("matchHeader works", function (t) {
var authorizationHeader = 'Basic ' + new Buffer('username:password').toString('base64');

var scope = nock('http://isomorphicfetchland.com').
get('/path2').
matchHeader('authorization', authorizationHeader).
reply(200, 'somemoardata');

return fetch('http://isomorphicfetchland.com/path2', {
headers: {
'Authorization': authorizationHeader,
}
}).
then(function (res) {
return res.text();
}).
then(function (text) {
scope.done();
t.equal(text, 'somemoardata', "response should match");
t.end();
}).
catch(function (err) {
throw err;
});
});

0 comments on commit 26b2610

Please sign in to comment.