Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
da7252d
implemented har feature
hrajwade96 Jun 23, 2024
f6f9491
reverting some code
hrajwade96 Jun 23, 2024
a1ba9bd
comments resolved, code refactoring
hrajwade96 Jun 24, 2024
ef3a637
added doc comments for buildHar
hrajwade96 Jun 24, 2024
058e053
exportController moved to method scope
hrajwade96 Jun 24, 2024
ae292ad
httpRequests moved to NetworkController class
hrajwade96 Jun 24, 2024
9d5231b
Merge branch 'master' into export_har_feature
hrajwade96 Jun 26, 2024
1b9e483
code comments resolved
hrajwade96 Jun 26, 2024
0e5cdbb
Merge remote-tracking branch 'origin/export_har_feature' into export_…
hrajwade96 Jun 26, 2024
5c306c1
removed pages, pageref and serverIPAddress
hrajwade96 Jun 27, 2024
5d8fc75
added header size and body size, creatorVersion set
hrajwade96 Jun 27, 2024
16faad7
organized imports
hrajwade96 Jun 27, 2024
f843862
Merge remote-tracking branch 'upstream/master' into export_har_feature
hrajwade96 Jul 4, 2024
1c4442c
removed mixin and override, changed year to 2024, renamed variable
hrajwade96 Jul 8, 2024
8c08441
moved constants, converted to enum
hrajwade96 Jul 8, 2024
625b452
downloadAsHar moved back to analytics constants
hrajwade96 Jul 11, 2024
3dd0274
added copyright header
hrajwade96 Jul 11, 2024
0261ab7
HarNetworkData model class added, serialisation and de-serialisation …
hrajwade96 Jul 12, 2024
b77c454
removed testing code
hrajwade96 Jul 12, 2024
484e9f2
added copyright, created enum, condition checking improvements, Used …
hrajwade96 Jul 16, 2024
f504b18
import optimised, used Serializable mixin
hrajwade96 Jul 16, 2024
258e34e
Merge remote-tracking branch 'upstream/master' into export_har_feature
hrajwade96 Jul 16, 2024
f741882
minor fix
hrajwade96 Jul 16, 2024
eb7f848
replaced dynamic with Object? in har network data, minor fix
hrajwade96 Jul 16, 2024
a608451
used enum
hrajwade96 Jul 16, 2024
b734dc3
header and dart docs added
hrajwade96 Jul 16, 2024
449f9e6
used HarNetworkData
hrajwade96 Jul 16, 2024
0175330
print removed, scope added to class name in dart docs
hrajwade96 Jul 17, 2024
6c13f54
dart docs improvements
hrajwade96 Jul 17, 2024
f332b40
removed -2ms
hrajwade96 Jul 17, 2024
70d9468
renamed exception variable
hrajwade96 Jul 17, 2024
6f03ce2
changed dynamic to Object?
hrajwade96 Jul 17, 2024
6c73e28
removed ignore, added cast everywhere, changed dynamic to Object?
hrajwade96 Jul 17, 2024
fb4fd58
removed ignore, added cast, added trailing comma
hrajwade96 Jul 17, 2024
0a0b4be
used isNullOrEmpty
hrajwade96 Jul 17, 2024
21f6a5f
import fixed
hrajwade96 Jul 18, 2024
2d12a0d
created new class HarDataEntry for code separation
hrajwade96 Jul 18, 2024
df0b56f
used values from constants, added dart docs
hrajwade96 Jul 19, 2024
23295fc
added constants
hrajwade96 Jul 19, 2024
1398c0e
improved code readability
hrajwade96 Jul 19, 2024
7bbdf80
replaced dynamic with Object?
hrajwade96 Jul 19, 2024
e1c9791
added type to list
hrajwade96 Jul 19, 2024
c0cb621
used values directly, removed unnecessary null checks
hrajwade96 Jul 20, 2024
daccfde
used values directly, fixed typo
hrajwade96 Jul 20, 2024
2692ea1
restructured har creation, implemented toJson
hrajwade96 Jul 20, 2024
01f5122
used values from constants
hrajwade96 Jul 20, 2024
c5c1842
changed dynamic to Object?, dart docs fix, added header
hrajwade96 Jul 25, 2024
2734fcb
added comments for explanation
hrajwade96 Jul 25, 2024
fb10b26
minor fixes
hrajwade96 Jul 26, 2024
8a65da8
added tests for HarDataEntry
hrajwade96 Jul 26, 2024
6443964
code reformatted, updated release notes
hrajwade96 Jul 26, 2024
89dae77
Merge branch 'master' into export_har_feature
hrajwade96 Jul 26, 2024
b26b833
minor change
hrajwade96 Jul 27, 2024
6d4177b
Merge remote-tracking branch 'origin/export_har_feature' into export_…
hrajwade96 Jul 27, 2024
83b4a3f
reverting change
hrajwade96 Jul 29, 2024
7d211fd
added missing trailing comma
hrajwade96 Jul 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions packages/devtools_app/lib/src/screens/network/constants.dart
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 packages/devtools_app/lib/src/screens/network/har_builder.dart
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,
},
};
}
Loading