Skip to content

Commit

Permalink
Merge pull request #37 from floatdrop/master
Browse files Browse the repository at this point in the history
Add test on Host header
  • Loading branch information
floatdrop committed Jan 24, 2015
2 parents e535190 + 768158b commit b13f842
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/test-headers.js
Expand Up @@ -14,15 +14,30 @@ tape('setup', function (t) {
});
});

tape('send user-agent and accept-encoding by default', function (t) {
tape('send user-agent header by default', function (t) {
got(s.url, function (err, data) {
var headers = JSON.parse(data);
t.equal(headers['accept-encoding'], 'gzip,deflate');
t.equal(headers['user-agent'], 'https://github.com/sindresorhus/got');
t.end();
});
});

tape('send accept-encoding header by default', function (t) {
got(s.url, function (err, data) {
var headers = JSON.parse(data);
t.equal(headers['accept-encoding'], 'gzip,deflate');
t.end();
});
});

tape('send host header by default', function (t) {
got(s.url, function (err, data) {
var headers = JSON.parse(data);
t.equal(headers.host, 'localhost:' + s.port);
t.end();
});
});

tape('transform headers names to lowercase', function (t) {
got(s.url, {headers:{'USER-AGENT': 'test'}}, function (err, data) {
var headers = JSON.parse(data);
Expand Down

0 comments on commit b13f842

Please sign in to comment.