Browse Source

add default `user-agent`

so it's possible to call the github api without being forced to specify it
http2
Sindre Sorhus 11 years ago
parent
commit
ce1ef7db34
  1. 2
      index.js

2
index.js

@ -14,6 +14,8 @@ module.exports = function (url, opts, cb) {
}
cb = cb || function () {};
opts = opts || {};
opts.headers = opts.headers || {'user-agent': 'https://github.com/sindresorhus/got'};
var parsedUrl = urlLib.parse(url);
var fn = parsedUrl.protocol === 'https:' ? https : http;

Loading…
Cancel
Save