Comparing version 0.5.2 to 0.5.3-beta1
@@ -228,2 +228,12 @@ 'use strict'; | ||
/** | ||
* Sets the name for this HTTP client. | ||
* | ||
* If set this property will be copied onto any errors returned by send(). | ||
* Filters may also choose to use this value for any other purpose. | ||
*/ | ||
withClientName(clientName) { | ||
return this.withConfig({clientName}); | ||
} | ||
/** | ||
* Set a custom filter which has access to the request/responses. | ||
@@ -230,0 +240,0 @@ * |
@@ -14,5 +14,14 @@ 'use strict'; | ||
function handleError(error) { | ||
if (requestConfig.clientName) { | ||
error.clientName = requestConfig.clientName; | ||
} | ||
throw error; | ||
} | ||
const startFilter = filters.reduceRight(wrapFilter, makeRequest); | ||
return p.Promise.resolve(requestConfig).then(startFilter); | ||
return p.Promise.resolve(requestConfig) | ||
.then(startFilter) | ||
.catch(handleError); | ||
} | ||
@@ -19,0 +28,0 @@ |
{ | ||
"name": "httplease", | ||
"version": "0.5.2", | ||
"version": "0.5.3-beta1", | ||
"description": "HTTP client library with support for pluggable filters, including Zipkin, ASAP, etc", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
35425
842