Closed RodolfoGS closed 1 year ago
When your request is timed out, the variable error in your try catch is undefined.
error
Reproducible Example 1:
try { await fetch('https://httpbin.org/json', { timeout: 1 }) } catch (error) { console.log(error) // error: undefined }
Reproducible Example 2: Run the test that I created in this PR without the fix applied
The function req.setTimeout does not return any parameter in their callback, also you need to close the request with status NGHTTP2_CANCEL
req.setTimeout
NGHTTP2_CANCEL
Source: https://nodejs.org/api/http2.html#http2streamsettimeoutmsecs-callback
When your request is timed out, the variable
error
in your try catch is undefined.Reproducible Example 1:
Reproducible Example 2: Run the test that I created in this PR without the fix applied
The function
req.setTimeout
does not return any parameter in their callback, also you need to close the request with statusNGHTTP2_CANCEL
Source: https://nodejs.org/api/http2.html#http2streamsettimeoutmsecs-callback