diff --git a/appveyor.yml b/appveyor.yml
index 2326409..54bd4c1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,12 +1,14 @@
-version: 2.0.{build}
-os: Visual Studio 2017
+version: 3.0.{build}
+os: Visual Studio 2022
configuration: Release
-assembly_info:
+dotnet_csproj:
patch: true
- file: '**\AssemblyInfo.*'
+ file: '**\*.csproj'
+ version: '{version}'
+ package_version: '{version}'
assembly_version: '{version}'
- assembly_file_version: '{version}'
- assembly_informational_version: '{version}'
+ file_version: '{version}'
+ informational_version: '{version}'
before_build:
- cmd: dotnet --version
@@ -23,4 +25,4 @@ test: off
artifacts:
- path: .\src\nuget\*.nupkg
- name: Libraries NuGet packages
\ No newline at end of file
+ name: Libraries NuGet packages
diff --git a/build.cake b/build.cake
index 215f3e6..9bd6d53 100644
--- a/build.cake
+++ b/build.cake
@@ -64,4 +64,4 @@ Task("Default")
.Does(()=> {
});
-RunTarget(target);
\ No newline at end of file
+RunTarget(target);
diff --git a/global.json b/global.json
deleted file mode 100644
index 5876fd4..0000000
--- a/global.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "sdk": {
- "version": "2.2.108"
- }
-}
\ No newline at end of file
diff --git a/src/HarSharp.UnitTests/HarSharp.UnitTests.csproj b/src/HarSharp.UnitTests/HarSharp.UnitTests.csproj
index 4480ddd..ef0ce51 100644
--- a/src/HarSharp.UnitTests/HarSharp.UnitTests.csproj
+++ b/src/HarSharp.UnitTests/HarSharp.UnitTests.csproj
@@ -1,11 +1,8 @@
-
- netcoreapp2.1
-
+ net6.0
false
-
all
@@ -15,15 +12,12 @@
-
-
PreserveNewest
-
+
-
\ No newline at end of file
diff --git a/src/HarSharp.UnitTests/packages.config b/src/HarSharp.UnitTests/packages.config
deleted file mode 100644
index d4e241a..0000000
--- a/src/HarSharp.UnitTests/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/HarSharp.sln b/src/HarSharp.sln
index 63ed1c8..8097d6a 100644
--- a/src/HarSharp.sln
+++ b/src/HarSharp.sln
@@ -1,54 +1,54 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26124.0
-MinimumVisualStudioVersion = 15.0.26124.0
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{70A15BB4-14C0-449C-B0A7-B06506F2ED43}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarSharp", "HarSharp\HarSharp.csproj", "{22FBDC05-C3A1-44E1-867E-737E59A3F4E3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarSharp.UnitTests", "HarSharp.UnitTests\HarSharp.UnitTests.csproj", "{41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x64.Build.0 = Debug|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x86.Build.0 = Debug|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|Any CPU.Build.0 = Release|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x64.ActiveCfg = Release|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x64.Build.0 = Release|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x86.ActiveCfg = Release|Any CPU
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x86.Build.0 = Release|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x64.Build.0 = Debug|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x86.Build.0 = Debug|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|Any CPU.Build.0 = Release|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x64.ActiveCfg = Release|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x64.Build.0 = Release|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x86.ActiveCfg = Release|Any CPU
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x86.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {22FBDC05-C3A1-44E1-867E-737E59A3F4E3} = {70A15BB4-14C0-449C-B0A7-B06506F2ED43}
- {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3} = {70A15BB4-14C0-449C-B0A7-B06506F2ED43}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26124.0
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{70A15BB4-14C0-449C-B0A7-B06506F2ED43}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarSharp", "HarSharp\HarSharp.csproj", "{22FBDC05-C3A1-44E1-867E-737E59A3F4E3}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarSharp.UnitTests", "HarSharp.UnitTests\HarSharp.UnitTests.csproj", "{41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x64.Build.0 = Debug|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Debug|x86.Build.0 = Debug|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x64.ActiveCfg = Release|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x64.Build.0 = Release|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x86.ActiveCfg = Release|Any CPU
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3}.Release|x86.Build.0 = Release|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x64.Build.0 = Debug|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Debug|x86.Build.0 = Debug|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x64.ActiveCfg = Release|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x64.Build.0 = Release|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x86.ActiveCfg = Release|Any CPU
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {22FBDC05-C3A1-44E1-867E-737E59A3F4E3} = {70A15BB4-14C0-449C-B0A7-B06506F2ED43}
+ {41BAC9B8-18EC-4781-AF33-4D0B820DF9B3} = {70A15BB4-14C0-449C-B0A7-B06506F2ED43}
+ EndGlobalSection
+EndGlobal
diff --git a/src/HarSharp/HarConvert.cs b/src/HarSharp/HarConvert.cs
index 10c02af..21673c4 100644
--- a/src/HarSharp/HarConvert.cs
+++ b/src/HarSharp/HarConvert.cs
@@ -1,7 +1,7 @@
using System;
using System.IO;
using System.Linq;
-using Newtonsoft.Json;
+using System.Text.Json;
namespace HarSharp
{
@@ -10,6 +10,12 @@ namespace HarSharp
///
public static class HarConvert
{
+ private static readonly JsonSerializerOptions _options = new()
+ {
+ PropertyNameCaseInsensitive = true,
+ DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
+ };
+
///
/// Deserialize HAR content to a HAR entity.
///
@@ -22,7 +28,7 @@ public static Har Deserialize(string harJson)
throw new ArgumentNullException(nameof(harJson));
}
- var result = JsonConvert.DeserializeObject(harJson);
+ var result = JsonSerializer.Deserialize(harJson, _options);
TransformPartialRedirectUrlToFull(result);
@@ -36,7 +42,12 @@ public static Har Deserialize(string harJson)
/// The HAR entity.
public static Har DeserializeFromFile(string fileName)
{
- return Deserialize(File.ReadAllText(fileName));
+ using var stream = File.OpenRead(fileName);
+ var result = JsonSerializer.Deserialize(stream, _options);
+
+ TransformPartialRedirectUrlToFull(result);
+
+ return result;
}
///
diff --git a/src/HarSharp/HarSharp.csproj b/src/HarSharp/HarSharp.csproj
index 131cb95..9fb53d2 100644
--- a/src/HarSharp/HarSharp.csproj
+++ b/src/HarSharp/HarSharp.csproj
@@ -1,10 +1,5 @@
-
- netstandard2.0
+ net6.0
-
-
-
-
\ No newline at end of file
diff --git a/src/HarSharp/Log.cs b/src/HarSharp/Log.cs
index 072331f..d7a8e37 100644
--- a/src/HarSharp/Log.cs
+++ b/src/HarSharp/Log.cs
@@ -42,12 +42,12 @@ public Log()
///
/// Gets the pages.
///
- public IList Pages { get; private set; }
+ public IList Pages { get; set; }
///
/// Gets the entries.
///
- public IList Entries { get; private set; }
+ public IList Entries { get; set; }
#endregion
}
}
diff --git a/src/HarSharp/MessageBase.cs b/src/HarSharp/MessageBase.cs
index 07efd84..9e89afd 100644
--- a/src/HarSharp/MessageBase.cs
+++ b/src/HarSharp/MessageBase.cs
@@ -27,12 +27,12 @@ protected MessageBase()
///
/// Gets the list of cookie objects.
///
- public IList Cookies { get; private set; }
+ public IList Cookies { get; set; }
///
/// Gets the list of header objects.
///
- public IList Headers { get; private set; }
+ public IList Headers { get; set; }
///
/// Gets or sets the total number of bytes from the start of the HTTP request message until (and including) the double CRLF before the body.
diff --git a/src/HarSharp/PostData.cs b/src/HarSharp/PostData.cs
index 7455aad..00660a5 100644
--- a/src/HarSharp/PostData.cs
+++ b/src/HarSharp/PostData.cs
@@ -31,7 +31,7 @@ public PostData()
///
/// Gets the list of posted parameters (in case of URL encoded parameters).
///
- public IList Params { get; private set; }
+ public IList Params { get; set; }
///
/// Gets or sets the plain text posted data.
diff --git a/src/HarSharp/Request.cs b/src/HarSharp/Request.cs
index e9d4143..fc7be17 100644
--- a/src/HarSharp/Request.cs
+++ b/src/HarSharp/Request.cs
@@ -37,7 +37,7 @@ public Request()
///
/// Gets the list of query parameter objects.
///
- public IList QueryString { get; private set; }
+ public IList QueryString { get; set; }
///
/// Gets or sets the posted data info.