Closed pcwiek closed 6 years ago
Thanks @pcwiek ! This is definitely a bug - seems this may be a case where the timeout is occurring as it's trying to establish a connection (hence, no response object yet created). I've filed a PR.
When will this fix be released?
Hi @nanandn, 2.0.1 has been published with this fix.
@DonutEspresso Thanks for publishing. Will try it soon.
Background: If we set
requestTimeout
in client options and it gets hit, we'll get an unhanded exception.Version: 2.0.0 Last working version (that I checked): 1.5.0
Let's jump right into it:
And here's what I found:
Working version https://github.com/restify/clients/blob/fbf5813fb4a7f24472985778fbd25640956f643c/lib/JsonClient.js#L70
Crashing version:
https://github.com/restify/clients/blob/dac7eb15bdc6758b1e1c9d8a0ad6e124421cb594/lib/JsonClient.js#L77
The callback in
StringClient
in the error branch is called ascallback(resErr, req, null, null)
, which means that access tores.body
will always fail because it's alwaysnull
.If it's just a matter of changing the assignment from:
into
then I can do it, but I'm not sure if that's the whole story.