Update har package name

This commit is contained in:
Ashita Prasad
2025-06-23 04:37:56 +05:30
parent 963bc400d9
commit a1eac15f06
20 changed files with 60 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
import 'package:har_parser/har_parser.dart' as hp;
import 'package:har/har.dart' as har;
import 'package:seed/seed.dart';
import '../consts.dart';
import '../models/models.dart';
@@ -8,8 +8,8 @@ class HarParserIO {
List<(String?, HttpRequestModel)>? getHttpRequestModelList(String content) {
content = content.trim();
try {
final hl = hp.harLogFromJsonStr(content);
final requests = hp.getRequestsFromHarLog(hl);
final hl = har.harLogFromJsonStr(content);
final requests = har.getRequestsFromHarLog(hl);
return requests
.map((req) => (req.$2.url, harRequestToHttpRequestModel(req.$2)))
.toList();
@@ -18,7 +18,7 @@ class HarParserIO {
}
}
HttpRequestModel harRequestToHttpRequestModel(hp.Request request) {
HttpRequestModel harRequestToHttpRequestModel(har.Request request) {
HTTPVerb method;
try {
@@ -33,7 +33,7 @@ class HarParserIO {
List<NameValueModel> params = [];
List<bool> isParamEnabledList = [];
for (var header in request.headers ?? <hp.Header>[]) {
for (var header in request.headers ?? <har.Header>[]) {
var name = header.name ?? "";
var value = header.value;
var activeHeader = header.disabled ?? false;
@@ -41,7 +41,7 @@ class HarParserIO {
isHeaderEnabledList.add(!activeHeader);
}
for (var query in request.queryString ?? <hp.Query>[]) {
for (var query in request.queryString ?? <har.Query>[]) {
var name = query.name ?? "";
var value = query.value;
var activeQuery = query.disabled ?? false;
@@ -77,7 +77,7 @@ class HarParserIO {
if (request.postData?.mimeType == "multipart/form-data") {
bodyContentType = ContentType.formdata;
var name, val;
for (var fd in request.postData?.params ?? <hp.Param>[]) {
for (var fd in request.postData?.params ?? <har.Param>[]) {
name = fd.name;
if (fd.contentType == "text/plain") {
formDataType = FormDataType.text;

View File

@@ -21,8 +21,8 @@ dependencies:
path: ../insomnia_collection
postman:
path: ../postman
har_parser:
path: ../har_parser
har:
path: ../har
seed: ^0.0.3
xml: ^6.3.0

View File

@@ -1,10 +1,9 @@
# melos_managed_dependency_overrides: har_parser
# melos_managed_dependency_overrides: curl_parser,insomnia_collection,postman,seed
# melos_managed_dependency_overrides: curl_parser,insomnia_collection,postman,seed,har
dependency_overrides:
curl_parser:
path: ../curl_parser
har_parser:
path: ..\\har_parser
har:
path: ../har
insomnia_collection:
path: ../insomnia_collection
postman:

View File

@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 Ashita Prasad, Ankit Mahato
Copyright 2025 Ashita Prasad, Ankit Mahato
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -1,4 +1,4 @@
# insomnia
# har
Seamlessly convert Har Collection Format v1.2 to Dart.
@@ -11,7 +11,7 @@ Currently, this package is being used by [API Dash](https://github.com/foss42/ap
### Example 1: Har collection JSON string to Har model
```dart
import 'package:har_parser/har_parser.dart';
import 'package:har/har.dart';
void main() {
// Example 1: Har collection JSON string to Har model
@@ -173,7 +173,7 @@ void main() {
### Example 2: Har collection from JSON
```dart
import 'package:har_parser/har_parser.dart';
import 'package:har/har.dart';
void main() {
// Example 2: Har collection from JSON
@@ -337,4 +337,4 @@ var collectionJson = {
## License
This project is licensed under the [Apache License 2.0](https://github.com/foss42/apidash/blob/main/packages/har_parser/LICENSE).
This project is licensed under the [Apache License 2.0](https://github.com/foss42/apidash/blob/main/packages/har/LICENSE).

View File

@@ -1,4 +1,4 @@
import 'package:har_parser/har_parser.dart';
import 'package:har/har.dart';
void main() {
//Example 1

View File

@@ -0,0 +1,4 @@
library har;
export 'models/models.dart';
export 'utils/har_utils.dart';

View File

@@ -1,4 +1,4 @@
name: har_parser
name: har
description: "Seamlessly convert har Format to Dart and vice versa."
version: 0.0.1
homepage: https://github.com/foss42/apidash

View File

@@ -1,4 +1,4 @@
import 'package:har_parser/har_parser.dart';
import 'package:har/har.dart';
import 'package:test/test.dart';
import 'collection_examples/collection_apidash.dart';

View File

@@ -1,4 +1,4 @@
import 'package:har_parser/models/models.dart';
import 'package:har/models/models.dart';
var collectionApiDashModel = HarLog(
log: Log(
@@ -62,7 +62,8 @@ var collectionApiDashModel = HarLog(
time: 200,
request: Request(
method: "GET",
url: "https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true",
url:
"https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true",
httpVersion: null,
cookies: null,
headers: [],
@@ -122,15 +123,32 @@ var collectionApiDashModel = HarLog(
request: Request(
method: "POST",
url: "https://api.apidash.dev/io/form",
headers: [Header(name: "User-Agent", value: "Test Agent", disabled: null)],
headers: [
Header(name: "User-Agent", value: "Test Agent", disabled: null)
],
queryString: [],
bodySize: 100,
postData: PostData(
mimeType: "multipart/form-data",
params: [
Param(name: "text", value: "API", fileName: null, contentType: "text/plain", disabled: null),
Param(name: "sep", value: "|", fileName: null, contentType: "text/plain", disabled: null),
Param(name: "times", value: "3", fileName: null, contentType: "text/plain", disabled: null)
Param(
name: "text",
value: "API",
fileName: null,
contentType: "text/plain",
disabled: null),
Param(
name: "sep",
value: "|",
fileName: null,
contentType: "text/plain",
disabled: null),
Param(
name: "times",
value: "3",
fileName: null,
contentType: "text/plain",
disabled: null)
],
),
),
@@ -160,8 +178,18 @@ var collectionApiDashModel = HarLog(
mimeType: "multipart/form-data",
text: null,
params: [
Param(name: "token", value: "xyz", fileName: null, contentType: "text/plain", disabled: null),
Param(name: "imfile", value: null, fileName: "hire AI.jpeg", contentType: "image/jpeg", disabled: null)
Param(
name: "token",
value: "xyz",
fileName: null,
contentType: "text/plain",
disabled: null),
Param(
name: "imfile",
value: null,
fileName: "hire AI.jpeg",
contentType: "image/jpeg",
disabled: null)
],
),
headersSize: null,

View File

@@ -1,4 +0,0 @@
library har_parser;
export 'models/models.dart';
export 'utils/har_parser_utils.dart';