You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You'd better use a more general name, like requestTimeout or networkTimeout, since we are using fetch + ReadableStream on most platforms rather than XHR-based for now.
BTW, what time is your timeout pointing to?
The elapsed time from the request sent until the response header is received?
Or the elapsed time of downloading the full file?
I have renamed the xhrTimeout option to requestTimeout, it stands for The elapsed time from the request sent until the response header is received.
Why we need such option?
Because browsers like Chrome require around 20 seconds to throw a timeout error when accessing an unreachable address(e.g. accessing a private network address in public), sometimes we prefer to a faster response.
Thanks for pointing out my mistake. According to the XHR Standard https://xhr.spec.whatwg.org/#the-timeout-attribute, even if a response header is received, a timeout error will be dispatched as long as the request has not been completed, and I have already tested such situation.
So I implemented requestTimeout option using setTimeout instead.
FredZeng
changed the title
feat: support 'xhrTimeout' option
feat: support 'requestTimeout' option
Mar 29, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.