Skip to content

[WIP] feat: support abortion of in-flight HTTP requests #1773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

JaffaKetchup
Copy link

@JaffaKetchup JaffaKetchup commented May 20, 2025

Resolves #424, closes #204, closes #424, closes #567
Closes #978, closes #521, closes #602, closes #819

As discussed in #424, this adds an Abortable interface for BaseRequests that provides an abortTrigger which Clients may use to abort requests.

Currently WIP:

  • Compliance tests
  • Release prep (changelog etc.)

Complete:

  • Basic implementation
  • IOClient, BrowserClient, and RetryClient support
  • Documentation

We can do it this time :D


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Implemented `Abortable` interface for all available `BaseRequest`s
Added abort support to `IOClient`
WIP: abort support for `BrowserClient`
@brianquinlan brianquinlan self-requested a review May 20, 2025 21:57
@brianquinlan
Copy link
Collaborator

The outline looks good so far! Let me know if you need me to press the button to run the workflows.

Copy link

Package publishing

Package Version Status Publish tag (post-merge)
package:cronet_http 1.4.0-wip WIP (no publish necessary)
package:cupertino_http 2.2.0 already published at pub.dev
package:http 1.4.1-wip (error) pubspec version (1.4.1-wip) and changelog (1.4.1) don't agree
package:http2 3.0.0 ready to publish http2-v3.0.0
package:http_multi_server 3.2.2 already published at pub.dev
package:http_parser 4.1.2 already published at pub.dev
package:http_profile 0.1.1-wip WIP (no publish necessary)
package:ok_http 0.1.1-wip WIP (no publish necessary)
package:web_socket 1.0.1 already published at pub.dev
package:web_socket_channel 3.0.3 already published at pub.dev

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

Copy link

PR Health

Changelog Entry
Package Changed Files
package:http pkgs/http/lib/http.dart
pkgs/http/lib/src/abortable.dart
pkgs/http/lib/src/base_request.dart
pkgs/http/lib/src/browser_client.dart
pkgs/http/lib/src/io_client.dart
pkgs/http/lib/src/multipart_request.dart
pkgs/http/lib/src/request.dart
pkgs/http/lib/src/streamed_request.dart

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ⚠️
File Coverage
pkgs/http/example/main.dart 💔 Not covered
pkgs/http/lib/http.dart 💚 100 %
pkgs/http/lib/src/abortable.dart 💚 100 %
pkgs/http/lib/src/base_request.dart 💚 88 %
pkgs/http/lib/src/browser_client.dart 💔 Not covered
pkgs/http/lib/src/io_client.dart 💔 83 % ⬇️ 3 %
pkgs/http/lib/src/multipart_request.dart 💔 93 % ⬇️ 4 %
pkgs/http/lib/src/request.dart 💔 96 % ⬇️ 2 %
pkgs/http/lib/src/streamed_request.dart 💔 75 % ⬇️ 25 %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ⚠️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
pkgs/http/example/main.dart

All source files should start with a license header.

This check can be disabled by tagging the PR with skip-license-check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design an API to support aborting requests Abort or cancel multipart request Cancellable requests
2 participants