Skip to content

feat(http): add timeout support to Request #2812

@jeffbcross

Description

@jeffbcross

Since XMLHttpRequest in JS/Browser and HttpRequest in Dart both allow specifying a timeout to automatically abort requests, the Request object should allow specifying this property.

Fetch doesn't yet support manual cancellation or user-defined timeout, and it could have undesired effects if timeout functionality were implemented in the Http library. For example, if a fetch-backed request timed out in 500ms, and the observable was retried 5 times, there could actually be 5 open connections by the time the retries have run their course. So it's recommended that fetch and other uncancelable backends that do not add their own logic to support cancellation or timeout specification, do not try to manually implement timeout behavior.

JSONP could probably be made to be consistently cancelable, and thus could support timeout.

So the timeout property should be documented as an optimization, only active if the underlying backend supports it.

As part of implementing this feature, the MockConnection should provide a means of fast-forwarding virtual time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort2: daysfeatureLabel used to distinguish feature request from other issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions