devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Cancelled requests are shown as "Pending"

Open ManuelRauber opened this issue 2 years ago • 2 comments

Hi,

I use the dio package to make HTTP requests to our API.

Dio provided a feature for canceling requests. Under the hood it uses HttpClientRequest.abort (see here in dio's source.

However, in DevTools it shows the request as Pending:

image

It would be nice if it could show, that the request has been aborted.


DevTools version: 2.25.0 Connected Device: CPU / OS: arm64 (64 bit) ios Dart Version: 3.1.3 Flutter Version: 3.13.7 / stable Framework / Engine: 2f708eb839 / a794cf2681 Connected app type: Flutter native (debug build)

ManuelRauber avatar Nov 02 '23 09:11 ManuelRauber

We should see if we get an event for abort() calls and if we do, we should mark the request as cancelled in the UI. If we do not get an event, we should see if that is something we can add in dart-io

kenzieschmoll avatar Dec 12 '23 19:12 kenzieschmoll

I found the abort call that appears to be used for cancel: https://github.com/dart-lang/sdk/blob/f5fe3dddcc3401fb4848418f639a6f28187d63ce/sdk/lib/_http/http_impl.dart#L1604

I blindly tried adding _profileData?.finishRequestWithErrorto it, but wasn't able to get those events in devtools so this may require some more thought to figure out how to get the events to propagate

I'll look back into this when I get a bigger chunk of time to research

CoderDake avatar May 02 '24 17:05 CoderDake

This should be fixed by https://dart-review.googlesource.com/c/sdk/+/375800

kenzieschmoll avatar Jul 17 '24 18:07 kenzieschmoll