Skip to content
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

Create WinGetUtil functionality for running installed package correlation #2221

Merged
merged 25 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
24bbb4e
Initial interface and runtime setup for API
JohnMcPMS May 13, 2022
409e0c0
Most of the work of moving the cpprestsdk JSON helpers into common
JohnMcPMS May 13, 2022
9141bcc
Moving of JSON helpers compiles
JohnMcPMS May 19, 2022
ec7cb5e
Needs refactoring to expose JSON manifest parsing
JohnMcPMS May 19, 2022
8baa220
Created public exposure of json parsing; need to move collection cont…
JohnMcPMS May 20, 2022
5b0dcf8
Move metadata collector to repository; rename blob; implement more pa…
JohnMcPMS May 20, 2022
5d09217
Make AppsAndFeaturesEntries parsable from outside
JohnMcPMS May 23, 2022
250442a
Part way through refactoring the correlation data to be more reusable
JohnMcPMS May 23, 2022
dbf58e2
Basic refactor to make the ARP correlation path directly reusable
JohnMcPMS May 25, 2022
cd7d437
Merge from master
JohnMcPMS May 25, 2022
4345add
Output code complete, capstone is to update with the new metadata
JohnMcPMS May 26, 2022
6cf5105
Code complete of initial version
JohnMcPMS May 26, 2022
851770c
A few minor tests and the method to enable detailed testing of the co…
JohnMcPMS May 26, 2022
397368b
Beginnings of full tests
JohnMcPMS Jun 1, 2022
113d32e
Test progress
JohnMcPMS Jun 3, 2022
0fe79e0
Initial test debugging and more implementation
JohnMcPMS Jun 4, 2022
4f8de0b
Finish unit tests
JohnMcPMS Jun 6, 2022
7362deb
Add new exports to def
JohnMcPMS Jun 10, 2022
2ccf806
Add merge function prototype
JohnMcPMS Jun 17, 2022
06992e8
Merge from master
JohnMcPMS Jun 17, 2022
b95fdfa
PR feedback
JohnMcPMS Jun 17, 2022
1a07763
Begin implementation of the merge function
JohnMcPMS Jun 17, 2022
3411c1c
Update to new design, adding Merge function
JohnMcPMS Jun 22, 2022
4335883
Spellin
JohnMcPMS Jun 22, 2022
11cfe73
Merge from master
JohnMcPMS Jun 22, 2022
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
3 changes: 2 additions & 1 deletion .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ denelon
depersist
deque
deserialize
Deserialize
deserializer
deserializes
deserializing
dest
devblogs
Expand Down Expand Up @@ -301,6 +301,7 @@ MContext
mday
memset
metadata
metadatas
microsoft
mimetype
Minimatch
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ashpatil
Ashwini
asm
ASwitch
ASYNCRTIMP
Atest
ATL
AType
Expand Down Expand Up @@ -99,6 +100,7 @@ deleteifnotneeded
desktopappinstaller
dirs
diskfull
dllimport
dnld
Dobbeleer
dsc
Expand All @@ -107,6 +109,7 @@ dvinns
dw
ecfr
ecfrbrowse
efgh
endian
enr
enums
Expand Down
6 changes: 3 additions & 3 deletions src/AppInstallerCLICore/ExecutionContextData.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace AppInstaller::CLI::Execution
PackagesToInstall,
// On import: Sources for the imported packages
Sources,
ARPSnapshot,
ARPCorrelationData,
CorrelatedAppsAndFeaturesEntries,
Dependencies,
DependencySource,
Expand Down Expand Up @@ -188,9 +188,9 @@ namespace AppInstaller::CLI::Execution
};

template <>
struct DataMapping<Data::ARPSnapshot>
struct DataMapping<Data::ARPCorrelationData>
{
using value_t = std::vector<Repository::Correlation::ARPEntrySnapshot>;
using value_t = Repository::Correlation::ARPCorrelationData;
};

template <>
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/ExecutionReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ namespace AppInstaller::CLI::Execution
std::string response;
if (!std::getline(m_in, response))
{
m_in.get();
THROW_HR(APPINSTALLER_CLI_ERROR_PROMPT_INPUT_ERROR);
}

Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/PackageCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "winget/RepositorySource.h"
#include <winget/Manifest.h>

#include <json.h>
#include <json/json.h>

#include <vector>

Expand Down
44 changes: 7 additions & 37 deletions src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,55 +615,25 @@ namespace AppInstaller::CLI::Workflow

if (installer && MightWriteToARP(installer->InstallerType))
{
Source arpSource = context.Reporter.ExecuteWithProgress(
[](IProgressCallback& progress)
{
Repository::Source result = Repository::Source(PredefinedSource::ARP);
result.Open(progress);
return result;
}, true);

std::vector<std::tuple<Utility::LocIndString, Utility::LocIndString, Utility::LocIndString>> entries;

for (const auto& entry : arpSource.Search({}).Matches)
{
auto installed = entry.Package->GetInstalledVersion();
if (installed)
{
entries.emplace_back(std::make_tuple(
entry.Package->GetProperty(PackageProperty::Id),
installed->GetProperty(PackageVersionProperty::Version),
installed->GetProperty(PackageVersionProperty::Channel)));
}
}

std::sort(entries.begin(), entries.end());

context.Add<Execution::Data::ARPSnapshot>(std::move(entries));
Repository::Correlation::ARPCorrelationData data;
data.CapturePreInstallSnapshot();
context.Add<Execution::Data::ARPCorrelationData>(std::move(data));
}
}
CATCH_LOG()

void ReportARPChanges(Execution::Context& context) try
{
if (!context.Contains(Execution::Data::ARPSnapshot))
if (!context.Contains(Execution::Data::ARPCorrelationData))
{
return;
}

const auto& manifest = context.Get<Execution::Data::Manifest>();
const auto& arpSnapshot = context.Get<Execution::Data::ARPSnapshot>();

// Open the ARP source again to get the (potentially) changed ARP entries
Source arpSource = context.Reporter.ExecuteWithProgress(
[](IProgressCallback& progress)
{
Repository::Source result = Repository::Source(PredefinedSource::ARP);
result.Open(progress);
return result;
}, true);
auto& arpCorrelationData = context.Get<Execution::Data::ARPCorrelationData>();

auto correlationResult = Correlation::FindARPEntryForNewlyInstalledPackage(manifest, arpSnapshot, arpSource);
arpCorrelationData.CapturePostInstallSnapshot();
auto correlationResult = arpCorrelationData.CorrelateForNewlyInstalled(manifest);

// Store the ARP entry found to match the package to record it in the tracking catalog later
if (correlationResult.Package)
Expand Down
30 changes: 15 additions & 15 deletions src/AppInstallerCLITests/ARPChanges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ TEST_CASE("ARPChanges_MSIX_Ignored", "[ARPChanges][workflow]")

context << SnapshotARPEntries;

REQUIRE(!context.Contains(Data::ARPSnapshot));
REQUIRE(!context.Contains(Data::ARPCorrelationData));

context << ReportARPChanges;

Expand All @@ -245,9 +245,9 @@ TEST_CASE("ARPChanges_CheckSnapshot", "[ARPChanges][workflow]")

context << SnapshotARPEntries;

REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

auto snapshot = context.Get<Data::ARPSnapshot>();
auto snapshot = context.Get<Data::ARPCorrelationData>().GetPreInstallSnapshot();

REQUIRE(context.EverythingResult.Matches.size() == snapshot.size());

Expand Down Expand Up @@ -279,7 +279,7 @@ TEST_CASE("ARPChanges_NoChange_NoMatch", "[ARPChanges][workflow]")
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context << ReportARPChanges;
context.ExpectEvent(0, 0, 0);
Expand All @@ -291,7 +291,7 @@ TEST_CASE("ARPChanges_NoChange_SingleMatch", "[ARPChanges][workflow]")
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddMatchResult("MatchId1", "MatchName1", "MatchPublisher1", "MatchVersion1");

Expand All @@ -305,7 +305,7 @@ TEST_CASE("ARPChanges_NoChange_MultiMatch", "[ARPChanges][workflow]")
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddMatchResult("MatchId1", "MatchName1", "MatchPublisher1", "MatchVersion1");
context.AddMatchResult("MatchId2", "MatchName2", "MatchPublisher2", "MatchVersion2");
Expand All @@ -320,7 +320,7 @@ TEST_CASE("ARPChanges_SingleChange_NoMatch", "[ARPChanges][workflow]")
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");

Expand All @@ -334,7 +334,7 @@ TEST_CASE("ARPChanges_SingleChange_SingleMatch", "[ARPChanges][workflow]")
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.AddMatchResult("MatchId1", "MatchName1", "MatchPublisher1", "MatchVersion1");
Expand All @@ -349,7 +349,7 @@ TEST_CASE("ARPChanges_SingleChange_MultiMatch", "[ARPChanges][workflow]")
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.AddMatchResult("MatchId1", "MatchName1", "MatchPublisher1", "MatchVersion1");
Expand All @@ -365,7 +365,7 @@ TEST_CASE("ARPChanges_MultiChange_NoMatch", "[ARPChanges][workflow]")
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.AddEverythingResult("EverythingId2", "EverythingName2", "EverythingPublisher2", "EverythingVersion2");
Expand All @@ -380,7 +380,7 @@ TEST_CASE("ARPChanges_MultiChange_SingleMatch_NoOverlap", "[ARPChanges][workflow
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.AddEverythingResult("EverythingId2", "EverythingName2", "EverythingPublisher2", "EverythingVersion2");
Expand All @@ -396,7 +396,7 @@ TEST_CASE("ARPChanges_MultiChange_SingleMatch_Overlap", "[ARPChanges][workflow]"
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.AddEverythingResult("EverythingId2", "EverythingName2", "EverythingPublisher2", "EverythingVersion2");
Expand All @@ -412,7 +412,7 @@ TEST_CASE("ARPChanges_MultiChange_MultiMatch_NoOverlap", "[ARPChanges][workflow]
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.AddEverythingResult("EverythingId2", "EverythingName2", "EverythingPublisher2", "EverythingVersion2");
Expand All @@ -429,7 +429,7 @@ TEST_CASE("ARPChanges_MultiChange_MultiMatch_SingleOverlap", "[ARPChanges][workf
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.AddEverythingResult("EverythingId2", "EverythingName2", "EverythingPublisher2", "EverythingVersion2");
Expand All @@ -446,7 +446,7 @@ TEST_CASE("ARPChanges_MultiChange_MultiMatch_MultiOverlap", "[ARPChanges][workfl
TestContext context;

context << SnapshotARPEntries;
REQUIRE(context.Contains(Data::ARPSnapshot));
REQUIRE(context.Contains(Data::ARPCorrelationData));

context.AddEverythingResult("EverythingId1", "EverythingName1", "EverythingPublisher1", "EverythingVersion1");
context.MatchResult.Matches.emplace_back(context.EverythingResult.Matches.back());
Expand Down
9 changes: 5 additions & 4 deletions src/AppInstallerCLITests/AppInstallerCLITests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_NO_ASYNCRTIMP;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib\json;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</TreatWarningAsError>
</ClCompile>
<Link>
Expand All @@ -129,7 +129,7 @@
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
<ClCompile>
<PreprocessorDefinitions>_NO_ASYNCRTIMP;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib\json;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</TreatWarningAsError>
</ClCompile>
<Link>
Expand All @@ -148,8 +148,8 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_NO_ASYNCRTIMP;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib\json;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib\json;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(MSBuildThisFileDirectory)..\AppInstallerCommonCore;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerRepositoryCore;$(MSBuildThisFileDirectory)..\AppInstallerCommonCore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore\Public;$(MSBuildThisFileDirectory)..\AppInstallerCLICore;$(ProjectDir)..\JsonCppLib;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</TreatWarningAsError>
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</TreatWarningAsError>
</ClCompile>
Expand Down Expand Up @@ -196,6 +196,7 @@
<ClCompile Include="GroupPolicy.cpp" />
<ClCompile Include="HashCommand.cpp" />
<ClCompile Include="HttpClientHelper.cpp" />
<ClCompile Include="InstallerMetadataCollectionContext.cpp" />
<ClCompile Include="ManifestComparator.cpp" />
<ClCompile Include="JsonHelper.cpp" />
<ClCompile Include="MsiExecArguments.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@
<ClCompile Include="Correlation.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="InstallerMetadataCollectionContext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MsixManifest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
6 changes: 3 additions & 3 deletions src/AppInstallerCLITests/CustomHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "TestSource.h"
#include "TestRestRequestHandler.h"
#include <Rest/Schema/1_1/Interface.h>
#include <Rest/Schema/JsonHelper.h>
#include <winget/JsonUtil.h>
#include <Rest/RestClient.h>
#include <winget/Settings.h>

Expand Down Expand Up @@ -79,7 +79,7 @@ TEST_CASE("RestClient_CustomHeader", "[RestSource][CustomHeader]")
}})delimiter");

std::optional<std::string> customHeader = "Testing custom header";
auto header = std::make_pair<>(CustomHeaderName, JsonHelper::GetUtilityString(customHeader.value()));
auto header = std::make_pair<>(CustomHeaderName, JSON::GetUtilityString(customHeader.value()));
HttpClientHelper helper{ GetCustomHeaderVerificationHandler(web::http::status_codes::OK, sample, header) };
RestClient client = RestClient::Create(utility::conversions::to_utf8string("https://restsource.com/api"), customHeader, std::move(helper));
REQUIRE(client.GetSourceIdentifier() == "Source123");
Expand Down Expand Up @@ -127,7 +127,7 @@ TEST_CASE("RestSourceSearch_NoCustomHeader", "[RestSource][CustomHeader]")
TEST_CASE("RestSourceSearch_CustomHeaderExceedingSize", "[RestSource][CustomHeader]")
{
std::string customHeader = "This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. This is a custom header that is longer than 1024 characters. ";
auto header = std::make_pair<>(CustomHeaderName, JsonHelper::GetUtilityString(customHeader));
auto header = std::make_pair<>(CustomHeaderName, JSON::GetUtilityString(customHeader));
HttpClientHelper helper{ GetCustomHeaderVerificationHandler(web::http::status_codes::OK, sampleSearchResponse, header) };

REQUIRE_THROWS_HR(RestClient::Create(utility::conversions::to_utf8string("https://restsource.com/api"), customHeader, std::move(helper)),
Expand Down
Loading