|
|
@ -17,6 +17,7 @@ tape('setup', 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['user-agent'], 'https://github.com/sindresorhus/got'); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
@ -25,6 +26,7 @@ tape('send user-agent header by default', function (t) { |
|
|
|
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(); |
|
|
|
}); |
|
|
@ -33,14 +35,16 @@ tape('send accept-encoding header by default', function (t) { |
|
|
|
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) { |
|
|
|
got(s.url, {headers: {'USER-AGENT': 'test'}}, function (err, data) { |
|
|
|
var headers = JSON.parse(data); |
|
|
|
|
|
|
|
t.equal(headers['user-agent'], 'test'); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|