Added size support to Network tab#9744
Conversation
srawlins
left a comment
There was a problem hiding this comment.
Looks great, thank you!
packages/devtools_app/lib/src/screens/network/network_request_inspector_views.dart
Outdated
Show resolved
Hide resolved
|
Merge in the master branch to resolve that merge conflict. |
|
Hi @srawlins |
|
Hi @srawlins, One test failed: The failing Thanks! |
packages/devtools_app/lib/src/screens/network/network_request_inspector_views.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app/lib/src/screens/network/network_screen.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app/lib/src/shared/http/http_request_data.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app/lib/src/screens/network/network_screen.dart
Outdated
Show resolved
Hide resolved
…ition, simplify code, and revert unnecessary changes
elliette
left a comment
There was a problem hiding this comment.
Thanks! A few changes but looks good!
packages/devtools_app/lib/src/screens/network/network_screen.dart
Outdated
Show resolved
Hide resolved
…ate units and added tests for responseBytes & formatBytes
|
autosubmit label was removed for flutter/devtools/9744, because - The status or check suite ubuntu-latest test_dart2js has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Overview
This PR adds support for displaying response payload size in the Network tab
and fixes #6165.
It introduces a new "Size" column in the network requests table and displays response size in the Overview panel of the request inspector.
Changes
1. Data Model Updates
File:
packages/devtools_app/lib/src/screens/network/network_model.dartAdded two new getters to the
NetworkRequestbase class:requestBytesresponseBytesImplemented these getters in the
Socketclass using:writeBytes: request sizereadBytes: response sizePurpose:
Expose byte-level data in a unified way for all network request types.
2. HTTP Data Handling
File:
packages/devtools_app/lib/src/shared/http/http_request_data.dartcontent-lengthheaderStringandList<String>header formatsPurpose:
Provide response size for HTTP requests when available, without requiring changes to the Dart VM.
3. Shared Utility
File:
packages/devtools_app/lib/src/screens/network/utils/http_utils.dartformatBytesinto a reusable utility functionkB,MB) to align with Chrome DevToolsPurpose:
Ensure consistent formatting across the network table and inspector views.
4. Network Table UI
File:
packages/devtools_app/lib/src/screens/network/network_screen.dart-when size is unavailable5. Request Inspector (Overview Panel)
File:
packages/devtools_app/lib/src/screens/network/network_request_inspector_views.dartAdded a new row:
Uses shared
formatBytesutility6. Tests
Added unit tests for:
formatBytesutility inhttp_utils_test.dartresponseBytesparsing logic inhttp_request_data.dartCovers edge cases including:
Why request size is not included
Request size is not reliably available for HTTP requests due to limitations in the current DevTools and VM service APIs:
HttpProfileRequestcontent-lengthare often absent for outgoing requestsWhile socket-level request size (
writeBytes) is available, it is not consistently applicable to HTTP requests.Therefore, including request size would require changes in the Dart SDK / VM layer.
This PR focuses on response size, which can be reliably determined using:
readBytescontent-lengthheader (when present)Screenshot
Future Work
Pre-launch Checklist
General checklist
Issues checklist
Tests checklist
AI-tooling checklist
Feature-change checklist
NEXT_RELEASE_NOTES.md