Browse Source

Add protocol to stdError (#277)

* Add protocol property to error properties test

* Add protocol to stdError object

Adds the protocol to the stdError object got uses for all its errors.
Closes #249.
extract-response
Alexander Tesfamichael 8 years ago
committed by Sindre Sorhus
parent
commit
919703cd8e
  1. 3
      index.js
  2. 1
      test/error.js

3
index.js

@ -334,7 +334,8 @@ function stdError(error, opts) {
host: opts.host,
hostname: opts.hostname,
method: opts.method,
path: opts.path
path: opts.path,
protocol: opts.protocol
});
}

1
test/error.js

@ -27,6 +27,7 @@ test('properties', async t => {
t.is(err.message, 'Response code 404 (Not Found)');
t.is(err.host, `${s.host}:${s.port}`);
t.is(err.method, 'GET');
t.is(err.protocol, 'http:');
}
});

Loading…
Cancel
Save