From 734e31e5658900ecd948cbddf111ed65e994dbe4 Mon Sep 17 00:00:00 2001 From: Alexander Tesfamichael Date: Thu, 23 Mar 2017 23:42:26 +0100 Subject: [PATCH 1/3] Add url property to be expected on stdError test --- test/error.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/error.js b/test/error.js index 40306d217..ff0f38512 100644 --- a/test/error.js +++ b/test/error.js @@ -28,6 +28,7 @@ test('properties', async t => { t.is(err.host, `${s.host}:${s.port}`); t.is(err.method, 'GET'); t.is(err.protocol, 'http:'); + t.is(err.url, err.response.requestUrl); } }); From c4d535223b6aead2607dd69720f2e407c5758c1b Mon Sep 17 00:00:00 2001 From: Alexander Tesfamichael Date: Thu, 23 Mar 2017 23:46:22 +0100 Subject: [PATCH 2/3] Add url property to stdError Closes #282 --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 757380ed2..4b23f4de8 100644 --- a/index.js +++ b/index.js @@ -336,7 +336,8 @@ function stdError(error, opts) { hostname: opts.hostname, method: opts.method, path: opts.path, - protocol: opts.protocol + protocol: opts.protocol, + url: opts.href }); } From c6ca0dd3834098a102a72c54dd96c46a8facf2d3 Mon Sep 17 00:00:00 2001 From: Alexander Tesfamichael Date: Fri, 24 Mar 2017 10:16:20 +0100 Subject: [PATCH 3/3] Document protocol and url stdErr properties --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 03846a16e..1cc601b60 100644 --- a/readme.md +++ b/readme.md @@ -176,7 +176,7 @@ Sets `options.method` to the method name and makes a request. ## Errors -Each error contains (if available) `statusCode`, `statusMessage`, `host`, `hostname`, `method` and `path` properties to make debugging easier. +Each error contains (if available) `statusCode`, `statusMessage`, `host`, `hostname`, `method`, `path`, `protocol` and `url` properties to make debugging easier. In Promise mode, the `response` is attached to the error.