-
Notifications
You must be signed in to change notification settings - Fork 389
Added size support to Network tab #9744
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
Open
Victowolf
wants to merge
18
commits into
flutter:master
Choose a base branch
from
Victowolf:feature/network-request-size
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
03abf66
Added size support to network tab
Victowolf 28a31c7
Added release notes entry for network response size feature
Victowolf f32b2e0
Resolve merge conflict in release notes
Victowolf c34ee25
Added documentation for byte formatting
Victowolf 4372092
Fix lint: match parameter names with base class
Victowolf 7f50b84
Fix lint: correct parameter name in AddressColumn
Victowolf c1547a2
Fix type handling for content-length header in responseBytes
Victowolf d6cf3e6
Fix layout spacing to ensure consistent widget tree
Victowolf eef762c
Fix variable placement for response size rendering
Victowolf b084c62
Fix parameter name to match ColumnData override
Victowolf 46ddb13
Addressed Requested changes: update size units, refactor column defin…
Victowolf cb115cd
Addressed Rquested Changes: refactor formatBytes into http_utils, upd…
Victowolf fef7e5f
fix : formatBytes test fail
Victowolf 3643367
fix: failed tests
Victowolf ba633b0
fix: baseJson missing parameter
Victowolf 504a9dc
NEXT_RELEASE_NOTES.md sync
Victowolf 7238ff0
Clean release notes before rebase
Victowolf 47c4050
Revert unintended changes to pubspec.lock
Victowolf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
packages/devtools_app/test/shared/http/http_request_data_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import 'package:devtools_app/src/shared/http/http_request_data.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| void main() { | ||
| group('responseBytes', () { | ||
| Map<String, Object?> baseJson(Map<String, Object?> responseHeaders) { | ||
| return { | ||
| 'isolateId': 'isolate-1', | ||
| 'id': 'request-1', | ||
| 'method': 'GET', | ||
| 'uri': 'https://example.com', | ||
| 'events': <Object?>[], | ||
| 'startTime': DateTime.now().microsecondsSinceEpoch, | ||
| 'endTime': DateTime.now().microsecondsSinceEpoch, | ||
| 'request': { | ||
| 'headers': <String, Object?>{}, | ||
| 'connectionInfo': null, | ||
| 'contentLength': null, | ||
| 'cookies': <Object?>[], | ||
| 'followRedirects': true, | ||
| 'maxRedirects': 5, | ||
| 'persistentConnection': true, | ||
| }, | ||
| 'response': { | ||
| 'headers': responseHeaders, | ||
| 'connectionInfo': null, | ||
| 'contentLength': null, | ||
| 'cookies': <Object?>[], | ||
| 'compressionState': 'ResponseBodyCompressionState.notCompressed', | ||
| 'isRedirect': false, | ||
| 'persistentConnection': true, | ||
| 'reasonPhrase': 'OK', | ||
| 'redirects': <Map<String, dynamic>>[], | ||
| 'statusCode': 200, | ||
| 'startTime': DateTime.now().microsecondsSinceEpoch, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| // Verifies parsing when content-length is a string value. | ||
| test('parses content-length from string', () { | ||
| final request = DartIOHttpRequestData.fromJson( | ||
| baseJson({'content-length': '1234'}), | ||
| null, | ||
| null, | ||
| ); | ||
|
|
||
| expect(request.responseBytes, 1234); | ||
| }); | ||
|
|
||
| // Verifies parsing when content-length is a list of strings. | ||
| test('parses content-length from list of strings', () { | ||
| final request = DartIOHttpRequestData.fromJson( | ||
| baseJson({ | ||
| 'content-length': ['5678'], | ||
| }), | ||
| null, | ||
| null, | ||
| ); | ||
|
|
||
| expect(request.responseBytes, 5678); | ||
| }); | ||
|
|
||
| // Ensures integer values inside a list are handled correctly. | ||
| test('handles integer in list', () { | ||
| final request = DartIOHttpRequestData.fromJson( | ||
| baseJson({ | ||
| 'content-length': [91011], | ||
| }), | ||
| null, | ||
| null, | ||
| ); | ||
|
|
||
| expect(request.responseBytes, 91011); | ||
| }); | ||
|
|
||
| // Returns null when header is missing. | ||
| test('returns null for missing header', () { | ||
| final request = DartIOHttpRequestData.fromJson(baseJson({}), null, null); | ||
|
|
||
| expect(request.responseBytes, null); | ||
| }); | ||
|
|
||
| // Returns null when parsing fails. | ||
| test('returns null for invalid value', () { | ||
| final request = DartIOHttpRequestData.fromJson( | ||
| baseJson({'content-length': 'invalid'}), | ||
| null, | ||
| null, | ||
| ); | ||
|
|
||
| expect(request.responseBytes, null); | ||
| }); | ||
| }); | ||
| } |
19 changes: 19 additions & 0 deletions
19
packages/devtools_app/test/shared/http/http_utils_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import 'package:devtools_app/src/screens/network/utils/http_utils.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| void main() { | ||
| group('formatBytes', () { | ||
| // Verifies correct formatting across different unit ranges. | ||
| test('formats bytes correctly', () { | ||
| expect(formatBytes(512), '512 B'); // bytes | ||
| expect(formatBytes(2000), '2.0 kB'); // kilobytes (base-10) | ||
| expect(formatBytes(1000000), '1.0 MB'); // megabytes (base-10) | ||
| }); | ||
|
|
||
| // Ensures handling of invalid or missing values. | ||
| test('handles null and negative values', () { | ||
| expect(formatBytes(null), '-'); | ||
| expect(formatBytes(-1), '-'); | ||
| }); | ||
| }); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.