mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
Update har package name
This commit is contained in:
24
packages/har/lib/utils/har_utils.dart
Normal file
24
packages/har/lib/utils/har_utils.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import '../models/har_log.dart';
|
||||
|
||||
List<(String?, Request)> getRequestsFromHarLog(HarLog? hl) {
|
||||
if (hl == null || hl.log == null || hl.log?.entries == null) {
|
||||
return [];
|
||||
}
|
||||
List<(String?, Request)> requests = [];
|
||||
if (hl.log?.entries?.isNotEmpty ?? false)
|
||||
for (var entry in hl.log!.entries!) {
|
||||
requests.addAll(getRequestsFromHarLogEntry(entry));
|
||||
}
|
||||
return requests;
|
||||
}
|
||||
|
||||
List<(String?, Request)> getRequestsFromHarLogEntry(Entry? entry) {
|
||||
if (entry == null) {
|
||||
return [];
|
||||
}
|
||||
List<(String?, Request)> requests = [];
|
||||
if (entry.request != null) {
|
||||
requests.add((entry.startedDateTime, entry.request!));
|
||||
}
|
||||
return requests;
|
||||
}
|
||||
Reference in New Issue
Block a user