Browse Source

Try pathname, if no path is specified

Closes #72
http2
Vsevolod Strukchinsky 10 years ago
parent
commit
d7a66baac7
  1. 4
      index.js
  2. 2
      test/test-arguments.js

4
index.js

@ -48,6 +48,10 @@ function got(url, opts, cb) {
'accept-encoding': 'gzip,deflate'
}, lowercaseKeys(opts.headers));
if (opts.pathname) {
opts.path = opts.pathname;
}
if (opts.query) {
if (typeof opts.query !== 'string') {
opts.query = querystring.stringify(opts.query);

2
test/test-arguments.js

@ -48,7 +48,7 @@ test('overrides querystring from opts', function (t) {
test('pathname confusion', function (t) {
got({protocol: 'http:', hostname: s.host, port: s.port, pathname: '/test'}, function (err) {
t.ok(/http:\/\/localhost:6767\/test response code/.test(err));
t.error(err);
t.end();
});
});

Loading…
Cancel
Save