-
Notifications
You must be signed in to change notification settings - Fork 361
implemented har feature #7970
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
Merged
Merged
implemented har feature #7970
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
da7252d
implemented har feature
hrajwade96 f6f9491
reverting some code
hrajwade96 a1ba9bd
comments resolved, code refactoring
hrajwade96 ef3a637
added doc comments for buildHar
hrajwade96 058e053
exportController moved to method scope
hrajwade96 ae292ad
httpRequests moved to NetworkController class
hrajwade96 9d5231b
Merge branch 'master' into export_har_feature
hrajwade96 1b9e483
code comments resolved
hrajwade96 0e5cdbb
Merge remote-tracking branch 'origin/export_har_feature' into export_…
hrajwade96 5c306c1
removed pages, pageref and serverIPAddress
hrajwade96 5d8fc75
added header size and body size, creatorVersion set
hrajwade96 16faad7
organized imports
hrajwade96 f843862
Merge remote-tracking branch 'upstream/master' into export_har_feature
hrajwade96 1c4442c
removed mixin and override, changed year to 2024, renamed variable
hrajwade96 8c08441
moved constants, converted to enum
hrajwade96 625b452
downloadAsHar moved back to analytics constants
hrajwade96 3dd0274
added copyright header
hrajwade96 0261ab7
HarNetworkData model class added, serialisation and de-serialisation …
hrajwade96 b77c454
removed testing code
hrajwade96 484e9f2
added copyright, created enum, condition checking improvements, Used …
hrajwade96 f504b18
import optimised, used Serializable mixin
hrajwade96 258e34e
Merge remote-tracking branch 'upstream/master' into export_har_feature
hrajwade96 f741882
minor fix
hrajwade96 eb7f848
replaced dynamic with Object? in har network data, minor fix
hrajwade96 a608451
used enum
hrajwade96 b734dc3
header and dart docs added
hrajwade96 449f9e6
used HarNetworkData
hrajwade96 0175330
print removed, scope added to class name in dart docs
hrajwade96 6c13f54
dart docs improvements
hrajwade96 f332b40
removed -2ms
hrajwade96 70d9468
renamed exception variable
hrajwade96 6f03ce2
changed dynamic to Object?
hrajwade96 6c73e28
removed ignore, added cast everywhere, changed dynamic to Object?
hrajwade96 fb4fd58
removed ignore, added cast, added trailing comma
hrajwade96 0a0b4be
used isNullOrEmpty
hrajwade96 21f6a5f
import fixed
hrajwade96 2d12a0d
created new class HarDataEntry for code separation
hrajwade96 df0b56f
used values from constants, added dart docs
hrajwade96 23295fc
added constants
hrajwade96 1398c0e
improved code readability
hrajwade96 7bbdf80
replaced dynamic with Object?
hrajwade96 e1c9791
added type to list
hrajwade96 c0cb621
used values directly, removed unnecessary null checks
hrajwade96 daccfde
used values directly, fixed typo
hrajwade96 2692ea1
restructured har creation, implemented toJson
hrajwade96 01f5122
used values from constants
hrajwade96 c5c1842
changed dynamic to Object?, dart docs fix, added header
hrajwade96 2734fcb
added comments for explanation
hrajwade96 fb10b26
minor fixes
hrajwade96 8a65da8
added tests for HarDataEntry
hrajwade96 6443964
code reformatted, updated release notes
hrajwade96 89dae77
Merge branch 'master' into export_har_feature
hrajwade96 b26b833
minor change
hrajwade96 6d4177b
Merge remote-tracking branch 'origin/export_har_feature' into export_…
hrajwade96 83b4a3f
reverting change
hrajwade96 7d211fd
added missing trailing comma
hrajwade96 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
88 changes: 88 additions & 0 deletions
88
packages/devtools_app/lib/src/screens/network/constants.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,88 @@ | ||
| // Copyright 2024 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| enum NetworkEventKeys { | ||
| log, | ||
| version, | ||
| creator, | ||
| name, | ||
| pages, | ||
| startedDateTime, | ||
| id, | ||
| title, | ||
| pageTimings, | ||
| onContentLoad, | ||
| onLoad, | ||
| entries, | ||
| pageref, | ||
| time, | ||
| request, | ||
| method, | ||
| url, | ||
| httpVersion, | ||
| cookies, | ||
| headers, | ||
| queryString, | ||
| postData, | ||
| mimeType, | ||
| text, | ||
| headersSize, | ||
| bodySize, | ||
| response, | ||
| status, | ||
| statusText, | ||
| content, | ||
| size, | ||
| redirectURL, | ||
| cache, | ||
| timings, | ||
| blocked, | ||
| dns, | ||
| connect, | ||
| send, | ||
| wait, | ||
| receive, | ||
| ssl, | ||
| serverIPAddress, | ||
| connection, | ||
| comment, | ||
| value, | ||
| uri, | ||
| redirects, | ||
| path, | ||
| domain, | ||
| expires, | ||
| httpOnly, | ||
| secure, | ||
| reasonPhrase, | ||
| } | ||
|
|
||
| class NetworkEventDefaults { | ||
| static const logVersion = '1.2'; | ||
| static const creatorName = 'devtools'; | ||
| static const onContentLoad = -1; | ||
| static const onLoad = -1; | ||
| static const httpVersion = 'HTTP/1.1'; | ||
| static const responseHttpVersion = 'http/2.0'; | ||
| static const blocked = -1; | ||
| static const dns = -1; | ||
| static const connect = -1; | ||
| static const send = 1; | ||
| static const receive = 1; | ||
| static const ssl = -1; | ||
| } | ||
|
|
||
| class NetworkEventCustomFieldKeys { | ||
| static const isolateId = '_isolateId'; | ||
| static const id = '_id'; | ||
| static const startTime = '_startTime'; | ||
| static const events = '_events'; | ||
| } | ||
|
|
||
| enum NetworkEventCustomFieldRemappedKeys { | ||
| isolateId, | ||
| id, | ||
| startTime, | ||
| events, | ||
| } |
42 changes: 42 additions & 0 deletions
42
packages/devtools_app/lib/src/screens/network/har_builder.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,42 @@ | ||
| // Copyright 2024 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import '../../shared/http/http_request_data.dart'; | ||
| import '../../shared/utils.dart'; | ||
| import 'constants.dart'; | ||
| import 'har_data_entry.dart'; | ||
|
|
||
| /// Builds a HAR (HTTP Archive) object from a list of HTTP requests. | ||
| /// | ||
| /// The HAR format is a JSON-based format used for logging a web browser's | ||
| /// interaction with a site. It is useful for performance analysis and | ||
| /// debugging. This function constructs the HAR object based on the 1.2 | ||
| /// specification. | ||
| /// | ||
| /// For more details on the HAR format, see the [HAR 1.2 Specification](https://github.com/ahmadnassri/har-spec/blob/master/versions/1.2.md). | ||
| /// | ||
| /// Parameters: | ||
| /// - [httpRequests]: A list of [DartIOHttpRequestData] data. | ||
| /// | ||
| /// Returns: | ||
| /// - A Map representing the HAR object. | ||
| Map<String, Object?> buildHar(List<DartIOHttpRequestData> httpRequests) { | ||
| // Build the creator | ||
| final creator = <String, Object?>{ | ||
| NetworkEventKeys.name.name: NetworkEventDefaults.creatorName, | ||
| NetworkEventKeys.version.name: devToolsVersion, | ||
| }; | ||
|
|
||
| // Build the entries | ||
| final entries = httpRequests.map((e) => HarDataEntry.toJson(e)).toList(); | ||
|
|
||
| // Assemble the final HAR object | ||
| return <String, Object?>{ | ||
| NetworkEventKeys.log.name: <String, Object?>{ | ||
| NetworkEventKeys.version.name: NetworkEventDefaults.logVersion, | ||
| NetworkEventKeys.creator.name: creator, | ||
| NetworkEventKeys.entries.name: entries, | ||
| }, | ||
| }; | ||
| } | ||
Oops, something went wrong.
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.