Skip to content

Commit 0f7a854

Browse files
committed
Improved cancellation status detection in Network profiler
1 parent d9162b6 commit 0f7a854

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

packages/devtools_app/lib/src/shared/http/http_request_data.dart

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,21 @@ class DartIOHttpRequestData extends NetworkRequest {
138138
DateTime? get _endTime =>
139139
_hasError ? _request.endTime : _request.response?.endTime;
140140

141-
static const _cancellationMarkers = [
142-
'cancel',
143-
'canceled',
144-
'cancelled',
145-
'operation canceled',
146-
'operation cancelled',
147-
'abort',
148-
'aborted',
149-
];
150-
151141
bool _matchesCancellationMarker(String? value) {
152-
final normalized = value?.toLowerCase();
153-
if (normalized == null) return false;
142+
if (value == null) return false;
143+
final normalized = value.toLowerCase();
144+
145+
/// Markers used for substring matching against request / response errors
146+
/// and request event names to classify cancelled requests.
147+
///
148+
/// Derived from observed cancellation wording in HTTP profiler payloads,
149+
/// keeping specific terms to reduce false positives.
150+
const _cancellationMarkers = [
151+
'canceled',
152+
'cancelled',
153+
'aborted',
154+
];
155+
154156
return _cancellationMarkers.any(normalized.contains);
155157
}
156158

@@ -172,7 +174,6 @@ class DartIOHttpRequestData extends NetworkRequest {
172174
return end?.difference(start);
173175
}
174176

175-
// Cancelled request
176177
if (isCancelled) {
177178
return Duration.zero;
178179
}

packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ TODO: Remove this section if there are not any updates.
3939

4040
## Network profiler updates
4141

42-
- Improve HTTP request status classification in the Network tab to better distinguish cancelled, completed, and in-flight requests (for example, avoiding some cases where cancelled requests appeared as pending). (#9683)
42+
- Added a filter setting to hide HTTP-profiler socket data. [#9698](https://github.com/flutter/devtools/pull/9698)
43+
- Improved HTTP request status classification in the Network tab to better distinguish cancelled, completed, and in-flight requests (for example, avoiding some cases where cancelled requests appeared as pending). [#9683](https://github.com/flutter/devtools/pull/9683)
4344

4445
## Logging updates
4546

4647
TODO: Remove this section if there are not any updates.
4748

4849
## App size tool updates
4950

50-
TODO: Remove this section if there are not any updates.
51+
- Added documentation links and improved handling for null files. [#9689](https://github.com/flutter/devtools/pull/9689)
5152

5253
## Deep links tool updates
5354

0 commit comments

Comments
 (0)