diff --git a/Directory.Build.props b/Directory.Build.props
index b1324646..838471e2 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,7 +4,7 @@
- 1.1.5
+ 1.1.6
diff --git a/GitHubReleaseNotes.txt b/GitHubReleaseNotes.txt
index 61febb61..34e8604b 100644
--- a/GitHubReleaseNotes.txt
+++ b/GitHubReleaseNotes.txt
@@ -1,3 +1,3 @@
https://github.com/StefH/GitHubReleaseNotes
-GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.1.5.0
\ No newline at end of file
+GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.1.6.0
\ No newline at end of file
diff --git a/WireMock.Net Solution.sln b/WireMock.Net Solution.sln
index 5a42c7a9..6f8d1af8 100644
--- a/WireMock.Net Solution.sln
+++ b/WireMock.Net Solution.sln
@@ -67,12 +67,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.Reques
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug - Sonar|Any CPU = Debug - Sonar|Any CPU
+ Debug - Sonar|x64 = Debug - Sonar|x64
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D3804228-91F4-4502-9595-39584E5A01AD}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {D3804228-91F4-4502-9595-39584E5A01AD}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {D3804228-91F4-4502-9595-39584E5A01AD}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {D3804228-91F4-4502-9595-39584E5A01AD}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{D3804228-91F4-4502-9595-39584E5A01AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3804228-91F4-4502-9595-39584E5A01AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3804228-91F4-4502-9595-39584E5A01AD}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -81,6 +87,10 @@ Global
{D3804228-91F4-4502-9595-39584E5A01AD}.Release|Any CPU.Build.0 = Release|Any CPU
{D3804228-91F4-4502-9595-39584E5A01AD}.Release|x64.ActiveCfg = Release|Any CPU
{D3804228-91F4-4502-9595-39584E5A01AD}.Release|x64.Build.0 = Release|Any CPU
+ {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -89,6 +99,10 @@ Global
{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Release|Any CPU.Build.0 = Release|Any CPU
{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Release|x64.ActiveCfg = Release|Any CPU
{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Release|x64.Build.0 = Release|Any CPU
+ {FE281639-B014-4C8A-96FA-141164A74713}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {FE281639-B014-4C8A-96FA-141164A74713}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {FE281639-B014-4C8A-96FA-141164A74713}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {FE281639-B014-4C8A-96FA-141164A74713}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{FE281639-B014-4C8A-96FA-141164A74713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE281639-B014-4C8A-96FA-141164A74713}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE281639-B014-4C8A-96FA-141164A74713}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -97,6 +111,10 @@ Global
{FE281639-B014-4C8A-96FA-141164A74713}.Release|Any CPU.Build.0 = Release|Any CPU
{FE281639-B014-4C8A-96FA-141164A74713}.Release|x64.ActiveCfg = Release|Any CPU
{FE281639-B014-4C8A-96FA-141164A74713}.Release|x64.Build.0 = Release|Any CPU
+ {1995E414-F197-4AB4-90C2-68D806B5AF59}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {1995E414-F197-4AB4-90C2-68D806B5AF59}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {1995E414-F197-4AB4-90C2-68D806B5AF59}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {1995E414-F197-4AB4-90C2-68D806B5AF59}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{1995E414-F197-4AB4-90C2-68D806B5AF59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1995E414-F197-4AB4-90C2-68D806B5AF59}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1995E414-F197-4AB4-90C2-68D806B5AF59}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -105,6 +123,10 @@ Global
{1995E414-F197-4AB4-90C2-68D806B5AF59}.Release|Any CPU.Build.0 = Release|Any CPU
{1995E414-F197-4AB4-90C2-68D806B5AF59}.Release|x64.ActiveCfg = Release|Any CPU
{1995E414-F197-4AB4-90C2-68D806B5AF59}.Release|x64.Build.0 = Release|Any CPU
+ {058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -113,6 +135,10 @@ Global
{058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Release|Any CPU.Build.0 = Release|Any CPU
{058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Release|x64.ActiveCfg = Release|Any CPU
{058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Release|x64.Build.0 = Release|Any CPU
+ {10E16614-61CA-48D8-8BDD-664C13913DED}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {10E16614-61CA-48D8-8BDD-664C13913DED}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {10E16614-61CA-48D8-8BDD-664C13913DED}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {10E16614-61CA-48D8-8BDD-664C13913DED}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -121,6 +147,10 @@ Global
{10E16614-61CA-48D8-8BDD-664C13913DED}.Release|Any CPU.Build.0 = Release|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Release|x64.ActiveCfg = Release|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Release|x64.Build.0 = Release|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA999}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA999}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA999}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA999}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.Build.0 = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -129,6 +159,10 @@ Global
{668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.Build.0 = Release|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Release|x64.ActiveCfg = Release|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Release|x64.Build.0 = Release|Any CPU
+ {049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -137,6 +171,10 @@ Global
{049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Release|Any CPU.Build.0 = Release|Any CPU
{049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Release|x64.ActiveCfg = Release|Any CPU
{049539C1-7A66-4559-AD7A-B1C73B97CBB0}.Release|x64.Build.0 = Release|Any CPU
+ {26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug - Sonar|x64.ActiveCfg = Debug|x64
+ {26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug - Sonar|x64.Build.0 = Debug|x64
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug|x64.ActiveCfg = Debug|x64
@@ -145,6 +183,10 @@ Global
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Release|Any CPU.Build.0 = Release|Any CPU
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Release|x64.ActiveCfg = Release|x64
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Release|x64.Build.0 = Release|x64
+ {23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -153,6 +195,10 @@ Global
{23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Release|Any CPU.Build.0 = Release|Any CPU
{23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Release|x64.ActiveCfg = Release|Any CPU
{23A9AA3C-40FC-42AA-8A5E-05899795A1C6}.Release|x64.Build.0 = Release|Any CPU
+ {3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -161,6 +207,10 @@ Global
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Release|Any CPU.Build.0 = Release|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Release|x64.ActiveCfg = Release|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Release|x64.Build.0 = Release|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -169,6 +219,10 @@ Global
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Release|Any CPU.Build.0 = Release|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Release|x64.ActiveCfg = Release|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Release|x64.Build.0 = Release|Any CPU
+ {1261BB9B-A7D4-456C-8985-3CE560361B8E}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {1261BB9B-A7D4-456C-8985-3CE560361B8E}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {1261BB9B-A7D4-456C-8985-3CE560361B8E}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {1261BB9B-A7D4-456C-8985-3CE560361B8E}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{1261BB9B-A7D4-456C-8985-3CE560361B8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1261BB9B-A7D4-456C-8985-3CE560361B8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1261BB9B-A7D4-456C-8985-3CE560361B8E}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -177,6 +231,10 @@ Global
{1261BB9B-A7D4-456C-8985-3CE560361B8E}.Release|Any CPU.Build.0 = Release|Any CPU
{1261BB9B-A7D4-456C-8985-3CE560361B8E}.Release|x64.ActiveCfg = Release|Any CPU
{1261BB9B-A7D4-456C-8985-3CE560361B8E}.Release|x64.Build.0 = Release|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA268}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA268}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA268}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {668F689E-57B4-422E-8846-C0FF643CA268}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA268}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA268}.Debug|Any CPU.Build.0 = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA268}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -185,6 +243,10 @@ Global
{668F689E-57B4-422E-8846-C0FF643CA268}.Release|Any CPU.Build.0 = Release|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA268}.Release|x64.ActiveCfg = Release|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA268}.Release|x64.Build.0 = Release|Any CPU
+ {83645809-9E01-4E81-8733-BA9497554ABF}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {83645809-9E01-4E81-8733-BA9497554ABF}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {83645809-9E01-4E81-8733-BA9497554ABF}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {83645809-9E01-4E81-8733-BA9497554ABF}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{83645809-9E01-4E81-8733-BA9497554ABF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83645809-9E01-4E81-8733-BA9497554ABF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83645809-9E01-4E81-8733-BA9497554ABF}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -193,6 +255,10 @@ Global
{83645809-9E01-4E81-8733-BA9497554ABF}.Release|Any CPU.Build.0 = Release|Any CPU
{83645809-9E01-4E81-8733-BA9497554ABF}.Release|x64.ActiveCfg = Release|Any CPU
{83645809-9E01-4E81-8733-BA9497554ABF}.Release|x64.Build.0 = Release|Any CPU
+ {B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -201,6 +267,10 @@ Global
{B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Release|Any CPU.Build.0 = Release|Any CPU
{B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Release|x64.ActiveCfg = Release|Any CPU
{B6269AAC-170A-43D6-8B9A-579DED3D9A96}.Release|x64.Build.0 = Release|Any CPU
+ {B6269AAC-170A-4346-8B9A-579DED3D9A94}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6269AAC-170A-4346-8B9A-579DED3D9A94}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {B6269AAC-170A-4346-8B9A-579DED3D9A94}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {B6269AAC-170A-4346-8B9A-579DED3D9A94}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{B6269AAC-170A-4346-8B9A-579DED3D9A94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6269AAC-170A-4346-8B9A-579DED3D9A94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6269AAC-170A-4346-8B9A-579DED3D9A94}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -209,6 +279,10 @@ Global
{B6269AAC-170A-4346-8B9A-579DED3D9A94}.Release|Any CPU.Build.0 = Release|Any CPU
{B6269AAC-170A-4346-8B9A-579DED3D9A94}.Release|x64.ActiveCfg = Release|Any CPU
{B6269AAC-170A-4346-8B9A-579DED3D9A94}.Release|x64.Build.0 = Release|Any CPU
+ {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -217,6 +291,10 @@ Global
{B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Release|Any CPU.Build.0 = Release|Any CPU
{B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Release|x64.ActiveCfg = Release|Any CPU
{B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Release|x64.Build.0 = Release|Any CPU
+ {A9D039B9-7509-4CF1-9EFD-87EB82998575}.Debug - Sonar|Any CPU.ActiveCfg = Debug|Any CPU
+ {A9D039B9-7509-4CF1-9EFD-87EB82998575}.Debug - Sonar|Any CPU.Build.0 = Debug|Any CPU
+ {A9D039B9-7509-4CF1-9EFD-87EB82998575}.Debug - Sonar|x64.ActiveCfg = Debug|Any CPU
+ {A9D039B9-7509-4CF1-9EFD-87EB82998575}.Debug - Sonar|x64.Build.0 = Debug|Any CPU
{A9D039B9-7509-4CF1-9EFD-87EB82998575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9D039B9-7509-4CF1-9EFD-87EB82998575}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9D039B9-7509-4CF1-9EFD-87EB82998575}.Debug|x64.ActiveCfg = Debug|Any CPU
diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml
index 676c02f4..827be256 100644
--- a/azure-pipelines-ci.yml
+++ b/azure-pipelines-ci.yml
@@ -49,7 +49,9 @@ steps:
%USERPROFILE%\.nuget\packages\codecov\1.1.0\tools\codecov.exe -f "./test/WireMock.Net.Tests/coverage.opencover.xml" -t $(CODECOV_TOKEN)
displayName: Upload coverage to codecov.io
+# https://github.com/microsoft/azure-pipelines-tasks/issues/12212
- task: PublishTestResults@2
+ condition: and(succeeded(), eq(variables['PUBLISH_TESTRESULTS'], 'yes'))
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
diff --git a/examples/WireMock.Net.Console.Net452.Classic/MainApp.cs b/examples/WireMock.Net.Console.Net452.Classic/MainApp.cs
index bda9e782..a1874422 100644
--- a/examples/WireMock.Net.Console.Net452.Classic/MainApp.cs
+++ b/examples/WireMock.Net.Console.Net452.Classic/MainApp.cs
@@ -59,7 +59,9 @@ namespace WireMock.Net.ConsoleApplication
{
var transformer = new CustomNameTransformer();
handlebarsContext.RegisterHelper(transformer.Name, transformer.Render);
- }
+ },
+
+ AllowAnyHttpStatusCodeInResponse = true
// Uncomment below if you want to use the CustomFileSystemFileHandler
// FileSystemHandler = new CustomFileSystemFileHandler()
diff --git a/examples/WireMock.Net.Console.Record.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj b/examples/WireMock.Net.Console.Record.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj
index aa44ab9d..c0c3c194 100644
--- a/examples/WireMock.Net.Console.Record.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj
+++ b/examples/WireMock.Net.Console.Record.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj
@@ -8,6 +8,7 @@
+
diff --git a/examples/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj b/examples/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj
index a240bad7..4a53e8f5 100644
--- a/examples/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj
+++ b/examples/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp2.1;netcoreapp2.0;netcoreapp1.1
+ netcoreapp2.1
../../WireMock.Net-Logo.ico
WireMock.Net.StandAlone.NETCoreApp.Program
diff --git a/examples/WireMock.Net.StandAlone.NETCoreApp/WireMockLog4NetLogger.cs b/examples/WireMock.Net.StandAlone.NETCoreApp/WireMockLog4NetLogger.cs
index a0ed6b15..27add78a 100644
--- a/examples/WireMock.Net.StandAlone.NETCoreApp/WireMockLog4NetLogger.cs
+++ b/examples/WireMock.Net.StandAlone.NETCoreApp/WireMockLog4NetLogger.cs
@@ -1,6 +1,7 @@
using System;
using log4net;
using Newtonsoft.Json;
+using WireMock.Admin.Requests;
using WireMock.Logging;
namespace WireMock.Net.StandAlone.NETCoreApp
diff --git a/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs b/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs
index a1849813..c2ff3833 100644
--- a/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs
+++ b/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs
@@ -49,10 +49,11 @@ namespace WireMock.Logging
///
/// Writes the message at the Error level using the specified exception.
///
- /// The message.
+ /// The format string.
/// The exception.
[PublicAPI]
- void Error([NotNull] string message, [NotNull] Exception exception);
+ [StringFormatMethod("formatString")]
+ void Error([NotNull] string formatString, [NotNull] Exception exception);
///
/// Writes the LogEntryModel (LogRequestModel, LogResponseModel and more).
diff --git a/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs b/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs
index 57aa8a07..595bd3f2 100644
--- a/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs
+++ b/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs
@@ -8,7 +8,6 @@ using JetBrains.Annotations;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
-using WireMock.Handlers;
using WireMock.HttpsCertificate;
using WireMock.Logging;
using WireMock.Owin.Mappers;
@@ -70,7 +69,6 @@ namespace WireMock.Owin
_host = builder
.ConfigureServices(services =>
{
- services.AddSingleton(_options.FileSystemHandler);
services.AddSingleton(_options);
services.AddSingleton();
services.AddSingleton();
diff --git a/src/WireMock.Net/Owin/GlobalExceptionMiddleware.cs b/src/WireMock.Net/Owin/GlobalExceptionMiddleware.cs
index 7aa03e71..72ba8221 100644
--- a/src/WireMock.Net/Owin/GlobalExceptionMiddleware.cs
+++ b/src/WireMock.Net/Owin/GlobalExceptionMiddleware.cs
@@ -63,7 +63,7 @@ namespace WireMock.Owin
}
catch (Exception ex)
{
- _options.Logger.Error("HttpStatusCode set to 500", ex);
+ _options.Logger.Error("HttpStatusCode set to 500 {0}", ex);
await _responseMapper.MapAsync(ResponseMessageBuilder.Create(JsonConvert.SerializeObject(ex), 500), ctx.Response);
}
}
diff --git a/src/WireMock.Net/Owin/IWireMockMiddlewareOptions.cs b/src/WireMock.Net/Owin/IWireMockMiddlewareOptions.cs
index 3d948847..2684a890 100644
--- a/src/WireMock.Net/Owin/IWireMockMiddlewareOptions.cs
+++ b/src/WireMock.Net/Owin/IWireMockMiddlewareOptions.cs
@@ -39,5 +39,7 @@ namespace WireMock.Owin
IFileSystemHandler FileSystemHandler { get; set; }
bool? AllowBodyForAllHttpMethods { get; set; }
+
+ bool? AllowAnyHttpStatusCodeInResponse { get; set; }
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net/Owin/Mappers/OwinResponseMapper.cs b/src/WireMock.Net/Owin/Mappers/OwinResponseMapper.cs
index d7c0e18b..e2a89d8b 100644
--- a/src/WireMock.Net/Owin/Mappers/OwinResponseMapper.cs
+++ b/src/WireMock.Net/Owin/Mappers/OwinResponseMapper.cs
@@ -1,16 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RandomDataGenerator.FieldOptions;
using RandomDataGenerator.Randomizers;
+using WireMock.Exceptions;
using WireMock.Handlers;
using WireMock.Http;
using WireMock.ResponseBuilders;
using WireMock.Types;
-using WireMock.Util;
using WireMock.Validation;
#if !USE_ASPNETCORE
using IResponse = Microsoft.Owin.IOwinResponse;
@@ -24,11 +25,11 @@ namespace WireMock.Owin.Mappers
///
/// OwinResponseMapper
///
- public class OwinResponseMapper : IOwinResponseMapper
+ internal class OwinResponseMapper : IOwinResponseMapper
{
private readonly IRandomizerNumber _randomizerDouble = RandomizerFactory.GetRandomizer(new FieldOptionsDouble { Min = 0, Max = 1 });
private readonly IRandomizerBytes _randomizerBytes = RandomizerFactory.GetRandomizer(new FieldOptionsBytes { Min = 100, Max = 200 });
- private readonly IFileSystemHandler _fileSystemHandler;
+ private readonly IWireMockMiddlewareOptions _options;
private readonly Encoding _utf8NoBom = new UTF8Encoding(false);
// https://msdn.microsoft.com/en-us/library/78h415ay(v=vs.110).aspx
@@ -43,12 +44,12 @@ namespace WireMock.Owin.Mappers
///
/// Constructor
///
- /// The IFileSystemHandler.
- public OwinResponseMapper(IFileSystemHandler fileSystemHandler)
+ /// The IWireMockMiddlewareOptions.
+ public OwinResponseMapper(IWireMockMiddlewareOptions options)
{
- Check.NotNull(fileSystemHandler, nameof(fileSystemHandler));
+ Check.NotNull(options, nameof(options));
- _fileSystemHandler = fileSystemHandler;
+ _options = options;
}
///
@@ -83,11 +84,13 @@ namespace WireMock.Owin.Mappers
switch (responseMessage.StatusCode)
{
case int statusCodeAsInteger:
- response.StatusCode = statusCodeAsInteger;
+ response.StatusCode = MapStatusCode(statusCodeAsInteger);
break;
case string statusCodeAsString:
- response.StatusCode = int.Parse(statusCodeAsString);
+ // Note: this case will also match on null
+ int.TryParse(statusCodeAsString, out int result);
+ response.StatusCode = MapStatusCode(result);
break;
}
@@ -99,6 +102,16 @@ namespace WireMock.Owin.Mappers
}
}
+ private int MapStatusCode(int code)
+ {
+ if (_options.AllowAnyHttpStatusCodeInResponse == true || Enum.IsDefined(typeof(HttpStatusCode), code))
+ {
+ return code;
+ }
+
+ return (int)HttpStatusCode.OK;
+ }
+
private bool IsFault(ResponseMessage responseMessage)
{
return responseMessage.FaultPercentage == null || _randomizerDouble.Generate() <= responseMessage.FaultPercentage;
@@ -126,7 +139,7 @@ namespace WireMock.Owin.Mappers
break;
case BodyType.File:
- bytes = _fileSystemHandler.ReadResponseBodyAsFile(responseMessage.BodyData.BodyAsFile);
+ bytes = _options.FileSystemHandler.ReadResponseBodyAsFile(responseMessage.BodyData.BodyAsFile);
break;
}
diff --git a/src/WireMock.Net/Owin/OwinSelfHost.cs b/src/WireMock.Net/Owin/OwinSelfHost.cs
index 67e80f45..e312d3d3 100644
--- a/src/WireMock.Net/Owin/OwinSelfHost.cs
+++ b/src/WireMock.Net/Owin/OwinSelfHost.cs
@@ -6,7 +6,6 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
-using WireMock.Handlers;
using WireMock.Logging;
using WireMock.Owin.Mappers;
using WireMock.Util;
@@ -76,7 +75,7 @@ namespace WireMock.Owin
try
{
var requestMapper = new OwinRequestMapper();
- var responseMapper = new OwinResponseMapper(_options.FileSystemHandler);
+ var responseMapper = new OwinResponseMapper(_options);
var matcher = new MappingMatcher(_options);
Action startup = app =>
diff --git a/src/WireMock.Net/Owin/WireMockMiddlewareOptions.cs b/src/WireMock.Net/Owin/WireMockMiddlewareOptions.cs
index 9a8b1da7..91ed19ab 100644
--- a/src/WireMock.Net/Owin/WireMockMiddlewareOptions.cs
+++ b/src/WireMock.Net/Owin/WireMockMiddlewareOptions.cs
@@ -42,5 +42,8 @@ namespace WireMock.Owin
///
public bool? AllowBodyForAllHttpMethods { get; set; }
+
+ ///
+ public bool? AllowAnyHttpStatusCodeInResponse { get; set; }
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net/ResponseBuilders/Response.cs b/src/WireMock.Net/ResponseBuilders/Response.cs
index 18197e91..07680b58 100644
--- a/src/WireMock.Net/ResponseBuilders/Response.cs
+++ b/src/WireMock.Net/ResponseBuilders/Response.cs
@@ -60,7 +60,7 @@ namespace WireMock.ResponseBuilders
[PublicAPI]
public static IResponseBuilder Create([CanBeNull] ResponseMessage responseMessage = null)
{
- var message = responseMessage ?? new ResponseMessage { StatusCode = (int)HttpStatusCode.OK };
+ var message = responseMessage ?? new ResponseMessage(); // { StatusCode = (int)HttpStatusCode.OK };
return new Response(message);
}
diff --git a/src/WireMock.Net/ResponseMessage.cs b/src/WireMock.Net/ResponseMessage.cs
index 798d6d70..31eeb06a 100644
--- a/src/WireMock.Net/ResponseMessage.cs
+++ b/src/WireMock.Net/ResponseMessage.cs
@@ -20,7 +20,7 @@ namespace WireMock
///
/// Gets or sets the status code.
///
- public object StatusCode { get; set; } = 200;
+ public object StatusCode { get; set; }
///
/// Gets or sets the body.
diff --git a/src/WireMock.Net/Server/WireMockServer.Admin.cs b/src/WireMock.Net/Server/WireMockServer.Admin.cs
index d9fe06f5..e0b6a0d1 100644
--- a/src/WireMock.Net/Server/WireMockServer.Admin.cs
+++ b/src/WireMock.Net/Server/WireMockServer.Admin.cs
@@ -491,12 +491,12 @@ namespace WireMock.Server
}
catch (ArgumentException a)
{
- _settings.Logger.Error("HttpStatusCode set to 400", a);
+ _settings.Logger.Error("HttpStatusCode set to 400 {0}", a);
return ResponseMessageBuilder.Create(a.Message, 400);
}
catch (Exception e)
{
- _settings.Logger.Error("HttpStatusCode set to 500", e);
+ _settings.Logger.Error("HttpStatusCode set to 500 {0}", e);
return ResponseMessageBuilder.Create(e.ToString(), 500);
}
}
@@ -813,13 +813,10 @@ namespace WireMock.Server
{
responseBuilder = responseBuilder.WithStatusCode(statusCodeAsString);
}
- else if (responseModel.StatusCode is int statusCodeAsInt && statusCodeAsInt > 0)
+ else if (responseModel.StatusCode != null)
{
- responseBuilder = responseBuilder.WithStatusCode(statusCodeAsInt);
- }
- else
- {
- responseBuilder = responseBuilder.WithStatusCode(HttpStatusCode.OK);
+ // Convert to Int32 because Newtonsoft deserializes an 'object' with a number value to a long.
+ responseBuilder = responseBuilder.WithStatusCode(Convert.ToInt32(responseModel.StatusCode));
}
if (responseModel.Headers != null)
@@ -876,7 +873,7 @@ namespace WireMock.Server
DetectedBodyType = BodyType.String,
BodyAsString = JsonConvert.SerializeObject(result, keepNullValues ? _settingsIncludeNullValues : _jsonSerializerSettings)
},
- StatusCode = 200,
+ StatusCode = (int) HttpStatusCode.OK,
Headers = new Dictionary> { { HttpKnownHeaderNames.ContentType, new WireMockList(ContentTypeJson) } }
};
}
diff --git a/src/WireMock.Net/Server/WireMockServer.cs b/src/WireMock.Net/Server/WireMockServer.cs
index 1dde5731..81b9f61a 100644
--- a/src/WireMock.Net/Server/WireMockServer.cs
+++ b/src/WireMock.Net/Server/WireMockServer.cs
@@ -258,7 +258,13 @@ namespace WireMock.Server
if (settings.AllowBodyForAllHttpMethods == true)
{
_options.AllowBodyForAllHttpMethods = _settings.AllowBodyForAllHttpMethods;
- _settings.Logger.Info("AllowBodyForAllHttpMethods is set to {0}", _settings.AllowBodyForAllHttpMethods == true);
+ _settings.Logger.Info("AllowBodyForAllHttpMethods is set to True");
+ }
+
+ if (settings.AllowAnyHttpStatusCodeInResponse == true)
+ {
+ _options.AllowAnyHttpStatusCodeInResponse = _settings.AllowAnyHttpStatusCodeInResponse;
+ _settings.Logger.Info("AllowAnyHttpStatusCodeInResponse is set to True");
}
if (settings.AllowPartialMapping == true)
diff --git a/src/WireMock.Net/Settings/IWireMockServerSettings.cs b/src/WireMock.Net/Settings/IWireMockServerSettings.cs
index 6d76c1cb..0238d95f 100644
--- a/src/WireMock.Net/Settings/IWireMockServerSettings.cs
+++ b/src/WireMock.Net/Settings/IWireMockServerSettings.cs
@@ -137,5 +137,11 @@ namespace WireMock.Settings
///
[PublicAPI]
bool? AllowBodyForAllHttpMethods { get; set; }
+
+ ///
+ /// Allow any HttpStatusCode in the response. Also null, 0, empty or invalid. (default set to false).
+ ///
+ /// [PublicAPI]
+ bool? AllowAnyHttpStatusCodeInResponse { get; set; }
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net/Settings/WireMockServerSettings.cs b/src/WireMock.Net/Settings/WireMockServerSettings.cs
index b379dd83..7121c3b4 100644
--- a/src/WireMock.Net/Settings/WireMockServerSettings.cs
+++ b/src/WireMock.Net/Settings/WireMockServerSettings.cs
@@ -101,5 +101,8 @@ namespace WireMock.Settings
///
[PublicAPI]
public bool? AllowBodyForAllHttpMethods { get; set; }
+
+ ///
+ public bool? AllowAnyHttpStatusCodeInResponse { get; set; }
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs b/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs
index 90a52530..c233be7b 100644
--- a/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs
+++ b/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs
@@ -34,7 +34,8 @@ namespace WireMock.Settings
MaxRequestLogCount = parser.GetIntValue("MaxRequestLogCount"),
RequestLogExpirationDuration = parser.GetIntValue("RequestLogExpirationDuration"),
AllowCSharpCodeMatcher = parser.GetBoolValue("AllowCSharpCodeMatcher"),
- AllowBodyForAllHttpMethods = parser.GetBoolValue("AllowBodyForAllHttpMethods")
+ AllowBodyForAllHttpMethods = parser.GetBoolValue("AllowBodyForAllHttpMethods"),
+ AllowAnyHttpStatusCodeInResponse = parser.GetBoolValue("AllowAnyHttpStatusCodeInResponse")
};
if (logger != null)
diff --git a/src/WireMock.Net/WireMock.Net.csproj b/src/WireMock.Net/WireMock.Net.csproj
index 98855ee8..a6b80f84 100644
--- a/src/WireMock.Net/WireMock.Net.csproj
+++ b/src/WireMock.Net/WireMock.Net.csproj
@@ -23,10 +23,9 @@
True-->
{D3804228-91F4-4502-9595-39584E5A01AD}
true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
true
WireMock.Net.snk
@@ -41,10 +40,14 @@
- $(MSBuildProjectDirectory)=/
+
true
+
+ WireMock.Net.ruleset
+
+
NETSTANDARD;USE_ASPNETCORE
@@ -58,7 +61,6 @@
-
@@ -78,8 +80,6 @@
-
-
diff --git a/test/WireMock.Net.Tests/Owin/Mappers/OwinResponseMapperTests.cs b/test/WireMock.Net.Tests/Owin/Mappers/OwinResponseMapperTests.cs
index 373804c4..a542ca77 100644
--- a/test/WireMock.Net.Tests/Owin/Mappers/OwinResponseMapperTests.cs
+++ b/test/WireMock.Net.Tests/Owin/Mappers/OwinResponseMapperTests.cs
@@ -9,6 +9,7 @@ using WireMock.Owin.Mappers;
using WireMock.ResponseBuilders;
using WireMock.Types;
using WireMock.Util;
+using WireMock.Owin;
#if NET452
using Microsoft.Owin;
using IResponse = Microsoft.Owin.IOwinResponse;
@@ -30,6 +31,7 @@ namespace WireMock.Net.Tests.Owin.Mappers
private readonly Mock _stream;
private readonly Mock _headers;
private readonly Mock _fileSystemHandlerMock;
+ private readonly Mock _optionsMock;
public OwinResponseMapperTests()
{
@@ -37,6 +39,13 @@ namespace WireMock.Net.Tests.Owin.Mappers
_stream.SetupAllProperties();
_stream.Setup(s => s.WriteAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(CompletedTask);
+ _fileSystemHandlerMock = new Mock();
+ _fileSystemHandlerMock.SetupAllProperties();
+
+ _optionsMock = new Mock();
+ _optionsMock.SetupAllProperties();
+ _optionsMock.SetupGet(o => o.FileSystemHandler).Returns(_fileSystemHandlerMock.Object);
+
_headers = new Mock();
_headers.SetupAllProperties();
#if NET452
@@ -50,10 +59,7 @@ namespace WireMock.Net.Tests.Owin.Mappers
_responseMock.SetupGet(r => r.Body).Returns(_stream.Object);
_responseMock.SetupGet(r => r.Headers).Returns(_headers.Object);
- _fileSystemHandlerMock = new Mock();
- _fileSystemHandlerMock.SetupAllProperties();
-
- _sut = new OwinResponseMapper(_fileSystemHandlerMock.Object);
+ _sut = new OwinResponseMapper(_optionsMock.Object);
}
[Fact]
@@ -63,20 +69,78 @@ namespace WireMock.Net.Tests.Owin.Mappers
await _sut.MapAsync(null, _responseMock.Object);
}
- [Fact]
- public async Task OwinResponseMapper_MapAsync_StatusCode()
+ [Theory]
+ [InlineData(0, 200)]
+ [InlineData(-1, 200)]
+ [InlineData(10000, 200)]
+ [InlineData(300, 300)]
+ public async Task OwinResponseMapper_MapAsync_StatusCode(object code, int expected)
{
// Arrange
var responseMessage = new ResponseMessage
{
- StatusCode = 302
+ StatusCode = code
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
- _responseMock.VerifySet(r => r.StatusCode = 302, Times.Once);
+ _responseMock.VerifySet(r => r.StatusCode = expected, Times.Once);
+ }
+
+ [Fact]
+ public async Task OwinResponseMapper_MapAsync_StatusCodeNull()
+ {
+ // Arrange
+ var responseMessage = new ResponseMessage
+ {
+ StatusCode = null
+ };
+
+ // Act
+ await _sut.MapAsync(responseMessage, _responseMock.Object);
+
+ // Assert
+ _responseMock.VerifyNoOtherCalls();
+ }
+
+ [Theory]
+ [InlineData(0, 0)]
+ [InlineData(-1, -1)]
+ [InlineData(10000, 10000)]
+ [InlineData(300, 300)]
+ public async Task OwinResponseMapper_MapAsync_StatusCode_WithAllowAll(object code, int expected)
+ {
+ // Arrange
+ _optionsMock.SetupGet(o => o.AllowAnyHttpStatusCodeInResponse).Returns(true);
+ var responseMessage = new ResponseMessage
+ {
+ StatusCode = code
+ };
+
+ // Act
+ await _sut.MapAsync(responseMessage, _responseMock.Object);
+
+ // Assert
+ _responseMock.VerifySet(r => r.StatusCode = expected, Times.Once);
+ }
+
+ [Fact]
+ public async Task OwinResponseMapper_MapAsync_StatusCode_WithAllowAll_Null()
+ {
+ // Arrange
+ _optionsMock.SetupGet(o => o.AllowAnyHttpStatusCodeInResponse).Returns(true);
+ var responseMessage = new ResponseMessage
+ {
+ StatusCode = null
+ };
+
+ // Act
+ await _sut.MapAsync(responseMessage, _responseMock.Object);
+
+ // Assert
+ _responseMock.VerifyNoOtherCalls();
}
[Fact]
diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsTests.cs
index 698a6a96..501c44eb 100644
--- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsTests.cs
+++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsTests.cs
@@ -149,7 +149,7 @@ namespace WireMock.Net.Tests.ResponseBuilders
// Assert
Check.That(responseMessage.BodyData.BodyAsString).Equals("test");
- Check.That(responseMessage.StatusCode).Equals(200);
+ Check.That(responseMessage.StatusCode).Equals(null);
}
[Fact]
diff --git a/test/WireMock.Net.Tests/WireMockAdminApiTests.cs b/test/WireMock.Net.Tests/WireMockAdminApiTests.cs
index 9711fd29..e654e655 100644
--- a/test/WireMock.Net.Tests/WireMockAdminApiTests.cs
+++ b/test/WireMock.Net.Tests/WireMockAdminApiTests.cs
@@ -91,9 +91,9 @@ namespace WireMock.Net.Tests
}
[Theory]
- [InlineData(null, 200)]
- [InlineData(-1, 200)]
- [InlineData(0, 200)]
+ [InlineData(null, null)]
+ [InlineData(-1, -1)]
+ [InlineData(0, 0)]
[InlineData(200, 200)]
[InlineData("200", "200")]
public async Task IWireMockAdminApi_PostMappingAsync(object statusCode, object expectedStatusCode)
diff --git a/test/WireMock.Net.Tests/WireMockServer.Settings.cs b/test/WireMock.Net.Tests/WireMockServer.Settings.cs
index 45d57cf9..ecb5c3d9 100644
--- a/test/WireMock.Net.Tests/WireMockServer.Settings.cs
+++ b/test/WireMock.Net.Tests/WireMockServer.Settings.cs
@@ -137,7 +137,25 @@ namespace WireMock.Net.Tests
Check.That(options.AllowBodyForAllHttpMethods).Equals(true);
// Verify
- _loggerMock.Verify(l => l.Info(It.IsAny(), It.IsAny()));
+ _loggerMock.Verify(l => l.Info(It.Is(s => s.Contains("AllowBodyForAllHttpMethods") && s.Contains("True"))));
+ }
+
+ [Fact]
+ public void WireMockServer_WireMockServerSettings_AllowAnyHttpStatusCodeInResponse()
+ {
+ // Assign and Act
+ var server = WireMockServer.Start(new WireMockServerSettings
+ {
+ Logger = _loggerMock.Object,
+ AllowAnyHttpStatusCodeInResponse = true
+ });
+
+ // Assert
+ var options = server.GetPrivateFieldValue("_options");
+ Check.That(options.AllowAnyHttpStatusCodeInResponse).Equals(true);
+
+ // Verify
+ _loggerMock.Verify(l => l.Info(It.Is(s => s.Contains("AllowAnyHttpStatusCodeInResponse") && s.Contains("True"))));
}
[Fact]