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!
| // - 1000000 → "1.0 MB" | ||
| // Values are rounded to one decimal place for kB and MB. | ||
| // Uses decimal (base-10) units to match Chrome DevTools. | ||
| String _formatBytes(int? bytes) { |
There was a problem hiding this comment.
Move formatBytes into http_utils.dart so it can be used here and in network_request_inspector_view.dart, and add a test
There was a problem hiding this comment.
Added the tests in test/shared/http/http_utils_test.dart.
|
|
||
| ## Network profiler updates | ||
|
|
||
| - Added response size ("Res Size") column to the Network tab and displayed response size in the request inspector overview. - |
There was a problem hiding this comment.
Can remove ("Res Size"), i.e. "Added response size column to..."
| } | ||
|
|
||
| @override | ||
| int? get responseBytes { |
There was a problem hiding this comment.
Sure, added tests in /test/shared/http/http_request_data_test.dart
…ate units and added tests for responseBytes & formatBytes
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