Closed connor4312 closed 7 years ago
Noticed you don't have saucelabs running on PR, so I ran them manually. They came up green except for Edge 14 which got stuck on the text streaming tests. https://peet.io/i/stream-http-test-output.txt
Just fyi I'm using this updated fork in the influx
browser tests and they pass. It works it real life 😄
In addition to supporting this, we should fix the setTimeout
method as well.
The issue there is that setTimeout
is called after the request method is fired. At that point we may have already called fetch
, which we can't timeout. The only ways to support that would be to either:
fetch
request. (Failing silently could lead to some nasty bugs.)While I'd be happy to help with implementation, I think both options for implementation are outside the scope of this PR.
Hey @jhiesey I wanted to follow up to see if you had any more thoughts on this or if it's good to merge! 😄
What's wrong with calling request.setTimeout
after the fetch starts? It should be fine to just start the timer a little late, and then cancel the timer when the fetch completes. If the timer doesn't get cancelled, it will fire and call the callback.
I'll merge this PR for now and then figure out what to do. I'll make sure a new version gets released in the next few days whether or not I add setTimeout
as well.
As seen in Node 6.8.0,
http.request
now supports atimeout
option. This PR adds support for that in stream-http! Unfortunately we have to force XHR since the Fetch API does not support timeouts (yet).