Skip to content

Commit 8ec75d6

Browse files
authored
add or update HTTP headers
1 parent 6fd7e48 commit 8ec75d6

File tree

8 files changed

+258
-175
lines changed

8 files changed

+258
-175
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
uses: actions/setup-dotnet@v1
2727
with:
2828
dotnet-version: '5.0.x'
29+
- name: Setup .NET Core 6.0
30+
uses: actions/setup-dotnet@v1
31+
with:
32+
dotnet-version: '6.0.x'
2933
- name: Initialize CodeQL
3034
uses: github/codeql-action/init@v1
3135
with:

.github/workflows/dotnet-core.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
uses: actions/setup-dotnet@v1
2525
with:
2626
dotnet-version: '5.0.x'
27+
- name: Setup .NET Core 6.0
28+
uses: actions/setup-dotnet@v1
29+
with:
30+
dotnet-version: '6.0.x'
2731
- name: Clean
2832
run: dotnet clean --configuration Release && dotnet nuget locals all --clear
2933
- name: Install dependencies

.github/workflows/sonarqube-analysis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ jobs:
2020
uses: actions/setup-dotnet@v1
2121
with:
2222
dotnet-version: '5.0.x'
23+
- name: Setup .NET Core 6.0
24+
uses: actions/setup-dotnet@v1
25+
with:
26+
dotnet-version: '6.0.x'
2327
- name: SonarScanner for .NET Core with pull request decoration support
24-
uses: highbyte/sonarscan-dotnet@2.0
28+
uses: highbyte/sonarscan-dotnet@v2.1.2
2529
with:
2630
sonarProjectKey: qatoolkit_qatoolkit-engine-httptester-net
2731
sonarProjectName: qatoolkit_qatoolkit-engine-httptester-net

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>0.3.4</Version>
3+
<Version>0.3.5</Version>
44
</PropertyGroup>
55
</Project>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ using (var client = new HttpTesterClient())
287287

288288
MIT License
289289

290-
Copyright (c) 2020-2021 Miha Jakovac
290+
Copyright (c) 2020-2022 Miha Jakovac
291291

292292
Permission is hereby granted, free of charge, to any person obtaining a copy
293293
of this software and associated documentation files (the "Software"), to deal

src/QAToolKit.Engine.HttpTester.Test/HttpTesterClientTests.cs

Lines changed: 207 additions & 164 deletions
Large diffs are not rendered by default.

src/QAToolKit.Engine.HttpTester.Test/QAToolKit.Engine.HttpTester.Test.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net5.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
@@ -12,11 +12,11 @@
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
1414
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
15-
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
16-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
18-
<PackageReference Include="ExpectedObjects" Version="3.5.3" />
19-
<PackageReference Include="QAToolKit.Source.Swagger" Version="0.3.9" />
15+
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
16+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
18+
<PackageReference Include="ExpectedObjects" Version="3.5.4" />
19+
<PackageReference Include="QAToolKit.Source.Swagger" Version="0.3.9" />
2020
<PackageReference Include="xunit" Version="2.4.1" />
2121
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
2222
<PrivateAssets>all</PrivateAssets>

src/QAToolKit.Engine.HttpTester/HttpTesterClient.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,26 @@ public IHttpTesterClient WithPathReplacementValues(Dictionary<string, string> pa
168168
/// <returns></returns>
169169
public IHttpTesterClient WithHeaders(Dictionary<string, string> headers)
170170
{
171-
_headers = headers ?? throw new ArgumentException($"{nameof(headers)} is null.");
172-
171+
if (headers == null)
172+
{
173+
throw new ArgumentException($"{nameof(headers)} is null.");
174+
}
175+
176+
if (_headers == null || _headers.Count == 0)
177+
{
178+
_headers = headers;
179+
}
180+
else
181+
{
182+
foreach (var header in headers)
183+
{
184+
if (!_headers.ContainsKey(header.Key))
185+
{
186+
_headers.Add(header.Key, header.Value);
187+
}
188+
}
189+
}
190+
173191
return this;
174192
}
175193

@@ -427,6 +445,16 @@ public async Task<HttpResponseMessage> Start()
427445
return _responseMessage;
428446
}
429447

448+
public Dictionary<string, string> GetRequestHeaders()
449+
{
450+
return _headers;
451+
}
452+
453+
public Dictionary<string, string> GetQueryParameters()
454+
{
455+
return _queryParameters;
456+
}
457+
430458
/// <summary>
431459
/// Dispose the object
432460
/// </summary>

0 commit comments

Comments
 (0)