mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-14 07:33:33 +01:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
801546fae7 | ||
|
|
57c42492bc | ||
|
|
057cd6c963 | ||
|
|
b2b7172043 | ||
|
|
13a3dfa9fe | ||
|
|
4020a178a6 | ||
|
|
30ee768430 | ||
|
|
5299ced000 | ||
|
|
e4df6cc93d | ||
|
|
abf3969bee | ||
|
|
a8339a0867 | ||
|
|
4721b73a16 | ||
|
|
c96d7d31b1 | ||
|
|
7b8e7bb684 | ||
|
|
68ad015dcf | ||
|
|
97d26338e6 | ||
|
|
0c6129e86b | ||
|
|
61c8ce76eb | ||
|
|
8e1b6f87f0 | ||
|
|
c6c7ba13b4 | ||
|
|
1174acce6e | ||
|
|
932dde07e4 |
42
CHANGELOG.md
42
CHANGELOG.md
@@ -1,3 +1,39 @@
|
||||
# 1.5.47 (25 January 2024)
|
||||
- [#1049](https://github.com/WireMock-Net/WireMock.Net/pull/1049) - Add WithoutHeader to WireMock.FluentAssertions [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1053](https://github.com/WireMock-Net/WireMock.Net/pull/1053) - [Snyk] Security upgrade Microsoft.IdentityModel.Protocols.OpenIdConnect from 6.12.2 to 6.34.0 [security] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1057](https://github.com/WireMock-Net/WireMock.Net/pull/1057) - Pin the version from Testcontainers to 3.7.0 in WireMock.Net.Testcontainers [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1048](https://github.com/WireMock-Net/WireMock.Net/issues/1048) - WithoutHeader fluent assertion [feature]
|
||||
- [#1054](https://github.com/WireMock-Net/WireMock.Net/issues/1054) - WireMock.Net 1.5.46 is incompatible with TestContainers 3.7.0 (issue 1) [bug]
|
||||
- [#1059](https://github.com/WireMock-Net/WireMock.Net/issues/1059) - WireMock.Net 1.5.46 is incompatible with TestContainers 3.7.0 (issue 2) [bug]
|
||||
|
||||
# 1.5.46 (23 December 2023)
|
||||
- [#1044](https://github.com/WireMock-Net/WireMock.Net/pull/1044) - WireMockServerSettingsParser [refactor] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1046](https://github.com/WireMock-Net/WireMock.Net/pull/1046) - Change FindRequestByMappingGuidAsync to return a collection of entries contributed by [tlevesque-ueat](https://github.com/tlevesque-ueat)
|
||||
|
||||
# 1.5.45 (21 December 2023)
|
||||
- [#1036](https://github.com/WireMock-Net/WireMock.Net/pull/1036) - Update Handlebars Transformer logic (ReplaceNodeOptions) [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1043](https://github.com/WireMock-Net/WireMock.Net/pull/1043) - FindRequestByMappingGuidAsync [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1039](https://github.com/WireMock-Net/WireMock.Net/issues/1039) - [Admin API] Find a request that matched a given mapping [feature]
|
||||
|
||||
# 1.5.44 (14 December 2023)
|
||||
- [#1040](https://github.com/WireMock-Net/WireMock.Net/pull/1040) - Implement prefix for saved mapping file [feature] contributed by [MindaugasLaganeckas](https://github.com/MindaugasLaganeckas)
|
||||
- [#1033](https://github.com/WireMock-Net/WireMock.Net/issues/1033) - How to get a Random Long? [bug]
|
||||
- [#1037](https://github.com/WireMock-Net/WireMock.Net/issues/1037) - Make mapping filenames more user friendly [feature]
|
||||
|
||||
# 1.5.43 (11 December 2023)
|
||||
- [#1026](https://github.com/WireMock-Net/WireMock.Net/pull/1026) - Add ProxyUrlReplaceSettings to Response [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1038](https://github.com/WireMock-Net/WireMock.Net/pull/1038) - Proxy all requests - even a repeated one [feature] contributed by [sameena-ops](https://github.com/sameena-ops)
|
||||
- [#592](https://github.com/WireMock-Net/WireMock.Net/issues/592) - Proxy all requests - even a repeated one [feature]
|
||||
- [#1024](https://github.com/WireMock-Net/WireMock.Net/issues/1024) - Scenario with proxy not removing route prefix [feature]
|
||||
|
||||
# 1.5.42 (09 December 2023)
|
||||
- [#1023](https://github.com/WireMock-Net/WireMock.Net/pull/1023) - Fix Mapping[] for WireMock.Org REST API [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1029](https://github.com/WireMock-Net/WireMock.Net/pull/1029) - Add ResponseWithHandlebarsDateTimeTests [test] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1031](https://github.com/WireMock-Net/WireMock.Net/pull/1031) - Calling Reset also resets the scenarios [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1034](https://github.com/WireMock-Net/WireMock.Net/pull/1034) - Workaround for: Random.Generate Type="Long" [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1021](https://github.com/WireMock-Net/WireMock.Net/issues/1021) - GetAdminMappingsResult in WireMock.Org.Abstractions should contain list of mappings [bug]
|
||||
- [#1030](https://github.com/WireMock-Net/WireMock.Net/issues/1030) - Reset resets only mappings and logentries, not scenarios. [bug]
|
||||
|
||||
# 1.5.41 (04 December 2023)
|
||||
- [#1012](https://github.com/WireMock-Net/WireMock.Net/pull/1012) - GraphQL - custom scalar support [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1018](https://github.com/WireMock-Net/WireMock.Net/pull/1018) - Add .NET 8 [feature] contributed by [StefH](https://github.com/StefH)
|
||||
@@ -150,7 +186,6 @@
|
||||
# 1.5.13 (11 December 2022)
|
||||
- [#858](https://github.com/WireMock-Net/WireMock.Net/pull/858) - Update Transformer functionality to return value instead of string [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#859](https://github.com/WireMock-Net/WireMock.Net/pull/859) - Add UpdatedAt property to Mapping [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#861](https://github.com/WireMock-Net/WireMock.Net/pull/861) - Add extra functionality for issue 55 contributed by [StefH](https://github.com/StefH)
|
||||
- [#862](https://github.com/WireMock-Net/WireMock.Net/pull/862) - Add client certificate support [feature] contributed by [billybraga](https://github.com/billybraga)
|
||||
- [#863](https://github.com/WireMock-Net/WireMock.Net/pull/863) - Update WireMockServer.CreateClient/CreateClients to include handlers [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#856](https://github.com/WireMock-Net/WireMock.Net/issues/856) - Inconsistent result with overlapping (duplicate) request [bug]
|
||||
@@ -194,8 +229,6 @@
|
||||
|
||||
# 1.5.6 (12 September 2022)
|
||||
- [#803](https://github.com/WireMock-Net/WireMock.Net/pull/803) - WebHook : UseFireAndForget + Delay [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#804](https://github.com/WireMock-Net/WireMock.Net/pull/804) - Change nuget to package reference for WireMock.Net.Console.Net472.Cla… [feature] contributed by [mattisking](https://github.com/mattisking)
|
||||
- [#806](https://github.com/WireMock-Net/WireMock.Net/pull/806) - Tweak middleware and fix bug in example [feature] contributed by [mattisking](https://github.com/mattisking)
|
||||
- [#801](https://github.com/WireMock-Net/WireMock.Net/issues/801) - Webhook Delays [feature]
|
||||
|
||||
# 1.5.5 (03 September 2022)
|
||||
@@ -767,7 +800,6 @@
|
||||
|
||||
# 1.0.15.0 (04 May 2019)
|
||||
- [#271](https://github.com/WireMock-Net/WireMock.Net/pull/271) - Support Dynamic response files using Handlebars templating [bug, feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#272](https://github.com/WireMock-Net/WireMock.Net/pull/272) - Add unit test for JsonPath and BodyAsFile mapping contributed by [denstorti](https://github.com/denstorti)
|
||||
- [#273](https://github.com/WireMock-Net/WireMock.Net/pull/273) - Dynamic response handlebars templating (2) [bug, feature] contributed by [StefH](https://github.com/StefH)
|
||||
|
||||
# 1.0.14.0 (20 April 2019)
|
||||
@@ -838,7 +870,6 @@
|
||||
- [#208](https://github.com/WireMock-Net/WireMock.Net/pull/208) - Refactor contributed by [StefH](https://github.com/StefH)
|
||||
- [#209](https://github.com/WireMock-Net/WireMock.Net/pull/209) - NET Core 2.1 + support for Service Fabric commandline parameters contributed by [StefH](https://github.com/StefH)
|
||||
- [#212](https://github.com/WireMock-Net/WireMock.Net/pull/212) - Update BodyParser logic contributed by [StefH](https://github.com/StefH)
|
||||
- [#216](https://github.com/WireMock-Net/WireMock.Net/pull/216) - ResponseBodyData contributed by [StefH](https://github.com/StefH)
|
||||
- [#217](https://github.com/WireMock-Net/WireMock.Net/pull/217) - Enable Source Link contributed by [kashifsoofi](https://github.com/kashifsoofi)
|
||||
- [#218](https://github.com/WireMock-Net/WireMock.Net/pull/218) - remove appveyor contributed by [StefH](https://github.com/StefH)
|
||||
- [#107](https://github.com/WireMock-Net/WireMock.Net/issues/107) - Feature: increase code coverage [feature]
|
||||
@@ -956,7 +987,6 @@
|
||||
|
||||
# 1.0.3.17 (16 May 2018)
|
||||
- [#134](https://github.com/WireMock-Net/WireMock.Net/pull/134) - Stef negate matcher contributed by [alastairtree](https://github.com/alastairtree)
|
||||
- [#135](https://github.com/WireMock-Net/WireMock.Net/pull/135) - Merge into the stef_negate_matcher branch (solves issue #133) contributed by [StefH](https://github.com/StefH)
|
||||
- [#138](https://github.com/WireMock-Net/WireMock.Net/pull/138) - Added Negate matcher logic contributed by [StefH](https://github.com/StefH)
|
||||
- [#130](https://github.com/WireMock-Net/WireMock.Net/issues/130) - ...
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.5.41</VersionPrefix>
|
||||
<VersionPrefix>1.5.47</VersionPrefix>
|
||||
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
||||
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
rem https://github.com/StefH/GitHubReleaseNotes
|
||||
|
||||
SET version=1.5.41
|
||||
SET version=1.5.47
|
||||
|
||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version% --token %GH_TOKEN%
|
||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate example --version %version% --token %GH_TOKEN%
|
||||
|
||||
GitHubReleaseNotes --output PackageReleaseNotes.txt --skip-empty-releases --exclude-labels question invalid doc duplicate --template PackageReleaseNotes.template --version %version% --token %GH_TOKEN%
|
||||
@@ -1,7 +1,10 @@
|
||||
# 1.5.41 (04 December 2023)
|
||||
- #1012 GraphQL - custom scalar support [feature]
|
||||
- #1018 Add .NET 8 [feature]
|
||||
- #1020 Add Github Action [test]
|
||||
- #984 GraphQL Schema validation with custom scalars [feature]
|
||||
# 1.5.47 (25 January 2024)
|
||||
- #1049 Add WithoutHeader to WireMock.FluentAssertions [feature]
|
||||
- #1053 [Snyk] Security upgrade Microsoft.IdentityModel.Protocols.OpenIdConnect from 6.12.2 to 6.34.0 [security]
|
||||
- #1055 Bump System.IdentityModel.Tokens.Jwt from 6.25.0 to 6.34.0 in /examples/WireMock.Net.Console.Net472.Classic [example]
|
||||
- #1057 Pin the version from Testcontainers to 3.7.0 in WireMock.Net.Testcontainers [bug]
|
||||
- #1048 WithoutHeader fluent assertion [feature]
|
||||
- #1054 WireMock.Net 1.5.46 is incompatible with TestContainers 3.7.0 (issue 1) [bug]
|
||||
- #1059 WireMock.Net 1.5.46 is incompatible with TestContainers 3.7.0 (issue 2) [bug]
|
||||
|
||||
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
||||
@@ -15,7 +15,8 @@ For more info, see also this WIKI page: [What is WireMock.Net](https://github.co
|
||||
* Can be used locally or in CI/CD scenarios
|
||||
|
||||
## :memo: Blogs
|
||||
- [mStack.nl : Generate C# Code from Mapping(s)](https://mstack.nl/blog/20230201-wiremock.net-tocode/)
|
||||
- [mstack.nl : Generate C# Code from Mapping(s)](https://mstack.nl/blog/20230201-wiremock.net-tocode/)
|
||||
- [mstack.nl : Chaos Engineering with Fault Injections](https://mstack.nl/blogs/wiremock-net-chaos-engineering-with-fault-injections/)
|
||||
|
||||
|
||||
## :computer: Project Info
|
||||
|
||||
@@ -36,8 +36,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NETCoreApp3", "examples\WireMock.Net.Console.NETCoreApp3\WireMock.Net.Console.NETCoreApp3.csproj", "{8C424EAF-8269-46A2-9FF1-F6D4EADB5CD5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.Proxy.NETCoreApp2", "examples\WireMock.Net.Console.Proxy.NETCoreApp2\WireMock.Net.Console.Proxy.NETCoreApp2.csproj", "{41C19451-E980-4ED4-A011-DA7A1C23FC05}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Client", "examples\WireMock.Net.Client\WireMock.Net.Client.csproj", "{74D91AD0-D96D-4FD2-AEC5-CC49D38346C0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NETCoreApp", "examples\WireMock.Net.Console.NETCoreApp\WireMock.Net.Console.NETCoreApp.csproj", "{FE281639-B014-4C8A-96FA-141164A74713}"
|
||||
@@ -50,8 +48,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.Net461
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.Net452.Classic", "examples\WireMock.Net.Console.Net452.Classic\WireMock.Net.Console.Net452.Classic.csproj", "{668F689E-57B4-422E-8846-C0FF643CA268}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NETCoreApp2", "examples\WireMock.Net.Console.NETCoreApp2\WireMock.Net.Console.NETCoreApp2.csproj", "{83645809-9E01-4E81-8733-BA9497554ABF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.RequestLogTest", "examples\WireMock.Net.Console.RequestLogTest\WireMock.Net.Console.RequestLogTest.csproj", "{A9D039B9-7509-4CF1-9EFD-87EB82998575}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.OpenApiParser", "src\WireMock.Net.OpenApiParser\WireMock.Net.OpenApiParser.csproj", "{D3804228-91F4-4502-9595-39584E5AADAD}"
|
||||
@@ -60,8 +56,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.OpenApiParser.
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.FluentAssertions", "src\WireMock.Net.FluentAssertions\WireMock.Net.FluentAssertions.csproj", "{B6269AAC-170A-4346-8B9A-579DED3D9A95}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.WebApplication.NETCore2", "examples\WireMock.Net.WebApplication.NETCore2\WireMock.Net.WebApplication.NETCore2.csproj", "{6F38CB3A-6DA1-408A-AECD-E434523C2838}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.WebApplication.NETCore3", "examples\WireMock.Net.WebApplication.NETCore3\WireMock.Net.WebApplication.NETCore3.csproj", "{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NETCoreApp3WithCertificate", "examples\WireMock.Net.Console.NETCoreApp3WithCertificate\WireMock.Net.Console.NETCoreApp3WithCertificate.csproj", "{925E421A-1B3F-4202-B48F-734743573A4B}"
|
||||
@@ -104,8 +98,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NET6.W
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueExample", "examples\WireMockAzureQueueExample\WireMockAzureQueueExample.csproj", "{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueProxy", "examples\WireMockAzureQueueProxy\WireMockAzureQueueProxy.csproj", "{ADB557D8-D66B-4387-912B-3F73E290B478}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Testcontainers", "src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj", "{12B016A5-9D8B-4EFE-96C2-CA51BE43367D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.TestcontainersExample", "examples\WireMock.Net.TestcontainersExample\WireMock.Net.TestcontainersExample.csproj", "{56A38798-C48B-4A4A-B805-071E05C02CE1}"
|
||||
@@ -118,6 +110,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.NET7.U
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NET8", "examples\WireMock.Net.Console.NET8\WireMock.Net.Console.NET8.csproj", "{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueProxy", "examples\WireMockAzureQueueProxy\WireMockAzureQueueProxy.csproj", "{7FC0B409-2682-40EE-B3B9-3930D6769D01}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -148,10 +142,6 @@ Global
|
||||
{8C424EAF-8269-46A2-9FF1-F6D4EADB5CD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8C424EAF-8269-46A2-9FF1-F6D4EADB5CD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8C424EAF-8269-46A2-9FF1-F6D4EADB5CD5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{41C19451-E980-4ED4-A011-DA7A1C23FC05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{41C19451-E980-4ED4-A011-DA7A1C23FC05}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{41C19451-E980-4ED4-A011-DA7A1C23FC05}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{41C19451-E980-4ED4-A011-DA7A1C23FC05}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{74D91AD0-D96D-4FD2-AEC5-CC49D38346C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{74D91AD0-D96D-4FD2-AEC5-CC49D38346C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{74D91AD0-D96D-4FD2-AEC5-CC49D38346C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -176,10 +166,6 @@ Global
|
||||
{668F689E-57B4-422E-8846-C0FF643CA268}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{668F689E-57B4-422E-8846-C0FF643CA268}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{668F689E-57B4-422E-8846-C0FF643CA268}.Release|Any CPU.Build.0 = Release|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}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83645809-9E01-4E81-8733-BA9497554ABF}.Release|Any CPU.Build.0 = Release|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}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -196,10 +182,6 @@ Global
|
||||
{B6269AAC-170A-4346-8B9A-579DED3D9A95}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B6269AAC-170A-4346-8B9A-579DED3D9A95}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B6269AAC-170A-4346-8B9A-579DED3D9A95}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6F38CB3A-6DA1-408A-AECD-E434523C2838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6F38CB3A-6DA1-408A-AECD-E434523C2838}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6F38CB3A-6DA1-408A-AECD-E434523C2838}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F38CB3A-6DA1-408A-AECD-E434523C2838}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -256,10 +238,6 @@ Global
|
||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ADB557D8-D66B-4387-912B-3F73E290B478}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ADB557D8-D66B-4387-912B-3F73E290B478}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ADB557D8-D66B-4387-912B-3F73E290B478}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ADB557D8-D66B-4387-912B-3F73E290B478}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{12B016A5-9D8B-4EFE-96C2-CA51BE43367D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{12B016A5-9D8B-4EFE-96C2-CA51BE43367D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{12B016A5-9D8B-4EFE-96C2-CA51BE43367D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -280,6 +258,10 @@ Global
|
||||
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7FC0B409-2682-40EE-B3B9-3930D6769D01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7FC0B409-2682-40EE-B3B9-3930D6769D01}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7FC0B409-2682-40EE-B3B9-3930D6769D01}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7FC0B409-2682-40EE-B3B9-3930D6769D01}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -291,19 +273,16 @@ Global
|
||||
{B6269AAC-170A-43D5-8B9A-579DED3D9A95} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||
{31DC2EF8-C3FE-467D-84BE-FB5D956E612E} = {0BB8B634-407A-4610-A91F-11586990767A}
|
||||
{8C424EAF-8269-46A2-9FF1-F6D4EADB5CD5} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{41C19451-E980-4ED4-A011-DA7A1C23FC05} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{74D91AD0-D96D-4FD2-AEC5-CC49D38346C0} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{FE281639-B014-4C8A-96FA-141164A74713} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{26433A8F-BF01-4962-97EB-81BFFBB61096} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{7F0B2446-0363-4720-AF46-F47F83B557DC} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{1261BB9B-A7D4-456C-8985-3CE560361B8E} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{668F689E-57B4-422E-8846-C0FF643CA268} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{83645809-9E01-4E81-8733-BA9497554ABF} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{A9D039B9-7509-4CF1-9EFD-87EB82998575} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{D3804228-91F4-4502-9595-39584E5AADAD} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||
{5C09FB93-1535-4F92-AF26-21E8A061EE4A} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{B6269AAC-170A-4346-8B9A-579DED3D9A95} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||
{6F38CB3A-6DA1-408A-AECD-E434523C2838} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{925E421A-1B3F-4202-B48F-734743573A4B} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{40BF24B5-12E6-4610-9489-138798632E28} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||
@@ -320,12 +299,12 @@ Global
|
||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{ADB557D8-D66B-4387-912B-3F73E290B478} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{12B016A5-9D8B-4EFE-96C2-CA51BE43367D} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||
{56A38798-C48B-4A4A-B805-071E05C02CE1} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{07C30227-ADEC-4BDE-8CDC-849D85A690BB} = {0147029F-FA4A-44B3-B79A-3C3574054EE4}
|
||||
{941229D6-191B-4B5E-AC81-0905EBF4F19D} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
{7FC0B409-2682-40EE-B3B9-3930D6769D01} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.0" />
|
||||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentAssertions" Version="6.11.0" />
|
||||
<PackageReference Include="WireMock.Net" Version="1.5.32" />
|
||||
<PackageReference Include="WireMock.Net" Version="1.5.42" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.0" />
|
||||
<!--<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.1.2" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.1.2" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.1.2" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.1.2" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.1.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.*" />-->
|
||||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
using log4net.Repository;
|
||||
using WireMock.Net.ConsoleApplication;
|
||||
|
||||
namespace WireMock.Net.Console.NETCoreApp2
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
|
||||
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
|
||||
|
||||
static void Main(params string[] args)
|
||||
{
|
||||
XmlConfigurator.Configure(LogRepository, new FileInfo("log4net.config"));
|
||||
|
||||
foreach (var file in Directory.GetFiles("__admin").Where(f => !f.StartsWith("wiremock")))
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
MainApp.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<ApplicationIcon>../../resources/WireMock.Net-Logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\WireMock.Net.Console.Net452.Classic\MainApp.cs" Link="MainApp.cs" />
|
||||
<Compile Include="..\WireMock.Net.Console.Net452.Classic\CustomFileSystemFileHandler.cs" Link="CustomFileSystemFileHandler.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="__admin\mappings\*.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="__admin\mappings\1.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="__admin\mappings\wiremock-petstore-openapi3.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="__admin\mappings\array.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.0" />
|
||||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="log4net.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="nlog.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="__admin\mappings\791a3f31-6946-4ce7-8e6f-0237c7443275.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="__admin\mappings\791a3f31-6946-4ce7-8e6f-0237c7443275.json">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="__admin\mappings\MyXmlResponse.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="__admin\mappings\wiremock-petstore-openapi3.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1 +0,0 @@
|
||||
// C# Hello
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"Request": {
|
||||
"Path": {
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "WildcardMatcher",
|
||||
"Pattern": "/static/mapping"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"BodyAsJson": { "body": "static mapping" },
|
||||
"Headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Test-X": [ "test 1", "test 2" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"Guid": "791a3f31-6946-4ce7-8e6f-0237c7443275",
|
||||
"Title": "",
|
||||
"Priority": 0,
|
||||
"Request": {
|
||||
"Path": "/proxy-google-test-post",
|
||||
"Methods": [
|
||||
"post"
|
||||
],
|
||||
"Body": {}
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 404,
|
||||
"Body": "<!DOCTYPE html>\n<html lang=en>\n <meta charset=utf-8>\n <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n <title>Error 404 (Not Found)!!1</title>\n <style>\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n </style>\n <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n <p><b>404.</b> <ins>That’s an error.</ins>\n <p>The requested URL <code>/proxy-google-test-post</code> was not found on this server. <ins>That’s all we know.</ins>\n",
|
||||
"BodyAsBytes": "PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ZW4+CiAgPG1ldGEgY2hhcnNldD11dGYtOD4KICA8bWV0YSBuYW1lPXZpZXdwb3J0IGNvbnRlbnQ9ImluaXRpYWwtc2NhbGU9MSwgbWluaW11bS1zY2FsZT0xLCB3aWR0aD1kZXZpY2Utd2lkdGgiPgogIDx0aXRsZT5FcnJvciA0MDQgKE5vdCBGb3VuZCkhITE8L3RpdGxlPgogIDxzdHlsZT4KICAgICp7bWFyZ2luOjA7cGFkZGluZzowfWh0bWwsY29kZXtmb250OjE1cHgvMjJweCBhcmlhbCxzYW5zLXNlcmlmfWh0bWx7YmFja2dyb3VuZDojZmZmO2NvbG9yOiMyMjI7cGFkZGluZzoxNXB4fWJvZHl7bWFyZ2luOjclIGF1dG8gMDttYXgtd2lkdGg6MzkwcHg7bWluLWhlaWdodDoxODBweDtwYWRkaW5nOjMwcHggMCAxNXB4fSogPiBib2R5e2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2Vycm9ycy9yb2JvdC5wbmcpIDEwMCUgNXB4IG5vLXJlcGVhdDtwYWRkaW5nLXJpZ2h0OjIwNXB4fXB7bWFyZ2luOjExcHggMCAyMnB4O292ZXJmbG93OmhpZGRlbn1pbnN7Y29sb3I6Izc3Nzt0ZXh0LWRlY29yYXRpb246bm9uZX1hIGltZ3tib3JkZXI6MH1AbWVkaWEgc2NyZWVuIGFuZCAobWF4LXdpZHRoOjc3MnB4KXtib2R5e2JhY2tncm91bmQ6bm9uZTttYXJnaW4tdG9wOjA7bWF4LXdpZHRoOm5vbmU7cGFkZGluZy1yaWdodDowfX0jbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzF4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7bWFyZ2luLWxlZnQ6LTVweH1AbWVkaWEgb25seSBzY3JlZW4gYW5kIChtaW4tcmVzb2x1dGlvbjoxOTJkcGkpeyNsb2dve2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIG5vLXJlcGVhdCAwJSAwJS8xMDAlIDEwMCU7LW1vei1ib3JkZXItaW1hZ2U6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIDB9fUBtZWRpYSBvbmx5IHNjcmVlbiBhbmQgKC13ZWJraXQtbWluLWRldmljZS1waXhlbC1yYXRpbzoyKXsjbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzJ4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7LXdlYmtpdC1iYWNrZ3JvdW5kLXNpemU6MTAwJSAxMDAlfX0jbG9nb3tkaXNwbGF5OmlubGluZS1ibG9jaztoZWlnaHQ6NTRweDt3aWR0aDoxNTBweH0KICA8L3N0eWxlPgogIDxhIGhyZWY9Ly93d3cuZ29vZ2xlLmNvbS8+PHNwYW4gaWQ9bG9nbyBhcmlhLWxhYmVsPUdvb2dsZT48L3NwYW4+PC9hPgogIDxwPjxiPjQwNC48L2I+IDxpbnM+VGhhdOKAmXMgYW4gZXJyb3IuPC9pbnM+CiAgPHA+VGhlIHJlcXVlc3RlZCBVUkwgPGNvZGU+L3Byb3h5LWdvb2dsZS10ZXN0LXBvc3Q8L2NvZGU+IHdhcyBub3QgZm91bmQgb24gdGhpcyBzZXJ2ZXIuICA8aW5zPlRoYXTigJlzIGFsbCB3ZSBrbm93LjwvaW5zPgo=",
|
||||
"BodyEncoding": {
|
||||
"CodePage": 65001,
|
||||
"EncodingName": "Unicode (UTF-8)",
|
||||
"WebName": "utf-8"
|
||||
},
|
||||
"UseTransformer": false,
|
||||
"Headers": {
|
||||
"Date": "Wed, 27 Oct 2017 18:57:40 GMT",
|
||||
"Alt-Svc": "quic=\":443\"; ma=2592000; v=\"39,38,37,35\"",
|
||||
"Referrer-Policy": "no-referrer",
|
||||
"Connection": "close"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"Guid": "873d495f-940e-4b86-a1f4-4f0fc7be8b8b",
|
||||
"Priority": 4,
|
||||
"Request": {
|
||||
"Path": {},
|
||||
"Methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyDestination": "SameAsSource",
|
||||
"Body": "NO PATH OR URL",
|
||||
"UseTransformer": false,
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"Request": {
|
||||
"Path": {
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "WildcardMatcher",
|
||||
"Pattern": "/bodyasfilexmltest",
|
||||
"IgnoreCase": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"Methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"Headers": {"Content-Type": "application/xml"},
|
||||
"BodyAsFile": "MyXmlResponse.xml",
|
||||
"UseTransformer": false
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<xml>
|
||||
<hello>world</hello>
|
||||
</xml>
|
||||
@@ -1,46 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Title": "1",
|
||||
"Request": {
|
||||
"Path": {
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "WildcardMatcher",
|
||||
"Pattern": "/mappings_static_1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"BodyAsJson": { "result": "mappings static_1" },
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Title": "2",
|
||||
"Request": {
|
||||
"Path": {
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "WildcardMatcher",
|
||||
"Pattern": "/mappings_static_2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"BodyAsJson": { "result": "mappings static_2" },
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,602 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Guid": "9d2fde55-e420-4724-bf40-616e8aeaf53e",
|
||||
"Request": {
|
||||
"Path": "/pet",
|
||||
"Methods": [
|
||||
"PUT"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": "example-string",
|
||||
"tags": "example-string",
|
||||
"status": "example-string"
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "1f7acffa-05f4-4640-bda4-4c71c8d5e6e3",
|
||||
"Request": {
|
||||
"Path": "/pet",
|
||||
"Methods": [
|
||||
"POST"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": "example-string",
|
||||
"tags": "example-string",
|
||||
"status": "example-string"
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "a04ed51d-ad5b-4c69-b22f-d0eaeea18bc1",
|
||||
"Request": {
|
||||
"Path": "/pet/findByStatus",
|
||||
"Methods": [
|
||||
"GET"
|
||||
],
|
||||
"Params": [
|
||||
{
|
||||
"Name": "status",
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "ExactMatcher",
|
||||
"Pattern": "example-string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": [
|
||||
"example-string",
|
||||
"example-string",
|
||||
"example-string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
}
|
||||
],
|
||||
"status": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": [
|
||||
"example-string",
|
||||
"example-string",
|
||||
"example-string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
}
|
||||
],
|
||||
"status": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": [
|
||||
"example-string",
|
||||
"example-string",
|
||||
"example-string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
}
|
||||
],
|
||||
"status": "example-string"
|
||||
}
|
||||
],
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "8d5df48a-05fb-4861-816f-3f77adf5562f",
|
||||
"Request": {
|
||||
"Path": "/pet/findByTags",
|
||||
"Methods": [
|
||||
"GET"
|
||||
],
|
||||
"Params": [
|
||||
{
|
||||
"Name": "tags",
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "ExactMatcher",
|
||||
"Pattern": "example-string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": [
|
||||
"example-string",
|
||||
"example-string",
|
||||
"example-string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
}
|
||||
],
|
||||
"status": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": [
|
||||
"example-string",
|
||||
"example-string",
|
||||
"example-string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
}
|
||||
],
|
||||
"status": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": [
|
||||
"example-string",
|
||||
"example-string",
|
||||
"example-string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
}
|
||||
],
|
||||
"status": "example-string"
|
||||
}
|
||||
],
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "065f790b-125c-419e-8fbd-3616bf09b142",
|
||||
"Request": {
|
||||
"Path": "/pet/42",
|
||||
"Methods": [
|
||||
"GET"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"name": "example-string",
|
||||
"category": {
|
||||
"id": 42,
|
||||
"name": "example-string"
|
||||
},
|
||||
"photoUrls": "example-string",
|
||||
"tags": "example-string",
|
||||
"status": "example-string"
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "737aaddd-5bab-489d-914b-deb4ba773539",
|
||||
"Request": {
|
||||
"Path": "/pet/42",
|
||||
"Methods": [
|
||||
"POST"
|
||||
],
|
||||
"Params": [
|
||||
{
|
||||
"Name": "name",
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "ExactMatcher",
|
||||
"Pattern": "example-string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "status",
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "ExactMatcher",
|
||||
"Pattern": "example-string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "0619896c-c3b3-4a30-903e-59792134898c",
|
||||
"Request": {
|
||||
"Path": "/pet/42",
|
||||
"Methods": [
|
||||
"DELETE"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "9aaa6a6d-ca4b-4da3-8a9a-844e3af02272",
|
||||
"Request": {
|
||||
"Path": "/pet/42/uploadImage",
|
||||
"Methods": [
|
||||
"POST"
|
||||
],
|
||||
"Params": [
|
||||
{
|
||||
"Name": "additionalMetadata",
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "ExactMatcher",
|
||||
"Pattern": "example-string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"code": 42,
|
||||
"type": "example-string",
|
||||
"message": "example-string"
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "085ef9c2-425d-45c2-9311-d3e4697c407f",
|
||||
"Request": {
|
||||
"Path": "/store/inventory",
|
||||
"Methods": [
|
||||
"GET"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "a68c50e9-418c-45e7-8340-c0426cf5b87c",
|
||||
"Request": {
|
||||
"Path": "/store/order",
|
||||
"Methods": [
|
||||
"POST"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"petId": 42,
|
||||
"quantity": 42,
|
||||
"shipDate": "2020-06-16T12:54:18.885+00:00",
|
||||
"status": "example-string",
|
||||
"complete": true
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "16061ffc-97a5-4419-874f-66d857998f76",
|
||||
"Request": {
|
||||
"Path": "/store/order/42",
|
||||
"Methods": [
|
||||
"GET"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"petId": 42,
|
||||
"quantity": 42,
|
||||
"shipDate": "2020-06-16T12:54:18.887+00:00",
|
||||
"status": "example-string",
|
||||
"complete": true
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "55c071d3-eeb5-4a9c-8692-486585e45e2e",
|
||||
"Request": {
|
||||
"Path": "/store/order/42",
|
||||
"Methods": [
|
||||
"DELETE"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "2d9d895d-58e9-4734-92f4-903e2b364dda",
|
||||
"Request": {
|
||||
"Path": "/user",
|
||||
"Methods": [
|
||||
"POST"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 0,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"username": "example-string",
|
||||
"firstName": "example-string",
|
||||
"lastName": "example-string",
|
||||
"email": "example-string",
|
||||
"password": "example-string",
|
||||
"phone": "example-string",
|
||||
"userStatus": 42
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "c17eeba0-da58-4128-9ae6-33a6a31971e2",
|
||||
"Request": {
|
||||
"Path": "/user/createWithList",
|
||||
"Methods": [
|
||||
"POST"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"username": "example-string",
|
||||
"firstName": "example-string",
|
||||
"lastName": "example-string",
|
||||
"email": "example-string",
|
||||
"password": "example-string",
|
||||
"phone": "example-string",
|
||||
"userStatus": 42
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "c95da645-9449-438e-a8c8-0278ea514558",
|
||||
"Request": {
|
||||
"Path": "/user/login",
|
||||
"Methods": [
|
||||
"GET"
|
||||
],
|
||||
"Params": [
|
||||
{
|
||||
"Name": "username",
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "ExactMatcher",
|
||||
"Pattern": "example-string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "password",
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "ExactMatcher",
|
||||
"Pattern": "example-string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": "example-string",
|
||||
"Headers": {
|
||||
"X-Rate-Limit": "example-string",
|
||||
"X-Expires-After": "example-string",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "bd05033f-1189-4d89-8cdc-f681399a46b3",
|
||||
"Request": {
|
||||
"Path": "/user/logout",
|
||||
"Methods": [
|
||||
"GET"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "7c1d49d4-e9f0-49b9-b898-f8c7d55ae472",
|
||||
"Request": {
|
||||
"Path": "/user/example-string",
|
||||
"Methods": [
|
||||
"GET"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200,
|
||||
"BodyAsJson": {
|
||||
"id": 42,
|
||||
"username": "example-string",
|
||||
"firstName": "example-string",
|
||||
"lastName": "example-string",
|
||||
"email": "example-string",
|
||||
"password": "example-string",
|
||||
"phone": "example-string",
|
||||
"userStatus": 42
|
||||
},
|
||||
"Headers": {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "1b7c4cd8-b251-480a-982e-c42d40dbfd4e",
|
||||
"Request": {
|
||||
"Path": "/user/example-string",
|
||||
"Methods": [
|
||||
"PUT"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Guid": "8a86e775-4bf9-490d-a52f-641458c256f7",
|
||||
"Request": {
|
||||
"Path": "/user/example-string",
|
||||
"Methods": [
|
||||
"DELETE"
|
||||
]
|
||||
},
|
||||
"Response": {
|
||||
"StatusCode": 200
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -28,12 +28,12 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.0" />
|
||||
<!--<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.0" />-->
|
||||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -325,6 +325,23 @@ namespace WireMock.Net.ConsoleApplication
|
||||
.WithHeader("Keep-Alive-Test", "stef")
|
||||
);
|
||||
|
||||
server
|
||||
.Given(Request.Create()
|
||||
.UsingGet()
|
||||
.WithPath("/proxy-replace")
|
||||
)
|
||||
.RespondWith(Response.Create()
|
||||
.WithProxy(new ProxyAndRecordSettings
|
||||
{
|
||||
Url = "http://localhost:9999",
|
||||
ReplaceSettings = new ProxyUrlReplaceSettings
|
||||
{
|
||||
OldValue = "old",
|
||||
NewValue = "new"
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
server
|
||||
.Given(Request.Create()
|
||||
.WithPath("/xpath").UsingPost()
|
||||
|
||||
@@ -55,11 +55,11 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="HandlebarsDotNet.Helpers.Core" publicKeyToken="00d131fae0c250bc" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.3.10.0" newVersion="2.3.10.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.4.1.2" newVersion="2.4.1.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="XPath2" publicKeyToken="463c6d7fb740c7e5" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.1.3.0" newVersion="1.1.3.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.1.4.0" newVersion="1.1.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
@@ -67,7 +67,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Handlebars.Net.Helpers" publicKeyToken="00d131fae0c250bc" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.3.10.0" newVersion="2.3.10.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.4.1.2" newVersion="2.4.1.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Linq.Dynamic.Core" publicKeyToken="0f07ec44de6ac832" culture="neutral" />
|
||||
|
||||
@@ -49,29 +49,29 @@
|
||||
<Reference Include="Handlebars, Version=2.1.4.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.2.1.4\lib\net46\Handlebars.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Handlebars.Net.Helpers, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.2.4.0\lib\net46\Handlebars.Net.Helpers.dll</HintPath>
|
||||
<Reference Include="Handlebars.Net.Helpers, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.2.4.1.2\lib\net46\Handlebars.Net.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Core, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Core.2.4.0\lib\net46\HandlebarsDotNet.Helpers.Core.dll</HintPath>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Core, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Core.2.4.1.2\lib\net46\HandlebarsDotNet.Helpers.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.DynamicLinq, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.DynamicLinq.2.4.0\lib\net46\HandlebarsDotNet.Helpers.DynamicLinq.dll</HintPath>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.DynamicLinq, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.DynamicLinq.2.4.1.2\lib\net46\HandlebarsDotNet.Helpers.DynamicLinq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Humanizer, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Humanizer.2.4.0\lib\net46\HandlebarsDotNet.Helpers.Humanizer.dll</HintPath>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Humanizer, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Humanizer.2.4.1.2\lib\net46\HandlebarsDotNet.Helpers.Humanizer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Json, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Json.2.4.0\lib\net46\HandlebarsDotNet.Helpers.Json.dll</HintPath>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Json, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Json.2.4.1.2\lib\net46\HandlebarsDotNet.Helpers.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Random, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Random.2.4.0\lib\net46\HandlebarsDotNet.Helpers.Random.dll</HintPath>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Random, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Random.2.4.1.2\lib\net46\HandlebarsDotNet.Helpers.Random.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Xeger, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Xeger.2.4.0\lib\net46\HandlebarsDotNet.Helpers.Xeger.dll</HintPath>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.Xeger, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Xeger.2.4.1.2\lib\net46\HandlebarsDotNet.Helpers.Xeger.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.XPath, Version=2.4.0.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.XPath.2.4.0\lib\net46\HandlebarsDotNet.Helpers.XPath.dll</HintPath>
|
||||
<Reference Include="HandlebarsDotNet.Helpers.XPath, Version=2.4.1.2, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.XPath.2.4.1.2\lib\net46\HandlebarsDotNet.Helpers.XPath.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Humanizer, Version=2.14.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Humanizer.Core.2.14.1\lib\netstandard2.0\Humanizer.dll</HintPath>
|
||||
@@ -232,14 +232,17 @@
|
||||
<Reference Include="Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Extensions.Primitives.5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Abstractions, Version=6.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.IdentityModel.Abstractions.6.25.0\lib\net472\Microsoft.IdentityModel.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.IdentityModel.Abstractions, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<HintPath>..\..\packages/Microsoft.IdentityModel.Abstractions.7.2.0/lib/net472/Microsoft.IdentityModel.Abstractions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.JsonWebTokens, Version=6.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.IdentityModel.JsonWebTokens.6.25.0\lib\net472\Microsoft.IdentityModel.JsonWebTokens.dll</HintPath>
|
||||
<Reference Include="Microsoft.IdentityModel.JsonWebTokens, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<HintPath>..\..\packages/Microsoft.IdentityModel.JsonWebTokens.7.2.0/lib/net472/Microsoft.IdentityModel.JsonWebTokens.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Logging, Version=6.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.IdentityModel.Logging.6.25.0\lib\net472\Microsoft.IdentityModel.Logging.dll</HintPath>
|
||||
<Reference Include="Microsoft.IdentityModel.Logging, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<HintPath>..\..\packages/Microsoft.IdentityModel.Logging.7.2.0/lib/net472/Microsoft.IdentityModel.Logging.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Protocols, Version=6.12.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.IdentityModel.Protocols.6.12.2\lib\net472\Microsoft.IdentityModel.Protocols.dll</HintPath>
|
||||
@@ -247,8 +250,9 @@
|
||||
<Reference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect, Version=6.12.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.IdentityModel.Protocols.OpenIdConnect.6.12.2\lib\net472\Microsoft.IdentityModel.Protocols.OpenIdConnect.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Tokens, Version=6.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.IdentityModel.Tokens.6.25.0\lib\net472\Microsoft.IdentityModel.Tokens.dll</HintPath>
|
||||
<Reference Include="Microsoft.IdentityModel.Tokens, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<HintPath>..\..\packages/Microsoft.IdentityModel.Tokens.7.2.0/lib/net472/Microsoft.IdentityModel.Tokens.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Net.Http.Headers, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.Headers.2.2.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
|
||||
@@ -296,8 +300,9 @@
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.4.5.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=6.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.IdentityModel.Tokens.Jwt.6.25.0\lib\net472\System.IdentityModel.Tokens.Jwt.dll</HintPath>
|
||||
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=6.34.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<HintPath>..\..\packages/System.IdentityModel.Tokens.Jwt.6.34.0/lib/net472/System.IdentityModel.Tokens.Jwt.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.IO.Pipelines.4.5.3\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
|
||||
@@ -305,8 +310,9 @@
|
||||
<Reference Include="System.Linq.Dynamic.Core, Version=1.3.1.0, Culture=neutral, PublicKeyToken=0f07ec44de6ac832, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Linq.Dynamic.Core.1.3.1\lib\net46\System.Linq.Dynamic.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
|
||||
<HintPath>..\..\packages/System.Memory.4.5.5/lib/net461/System.Memory.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
@@ -352,11 +358,11 @@
|
||||
<Reference Include="TinyMapper, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\TinyMapper.3.0.3\lib\net40\TinyMapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="XPath2, Version=1.1.3.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\XPath2.1.1.3\lib\net452\XPath2.dll</HintPath>
|
||||
<Reference Include="XPath2, Version=1.1.4.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\XPath2.1.1.4\lib\net452\XPath2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="XPath2.Extensions, Version=1.1.3.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\XPath2.Extensions.1.1.3\lib\net452\XPath2.Extensions.dll</HintPath>
|
||||
<Reference Include="XPath2.Extensions, Version=1.1.4.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\XPath2.Extensions.1.1.4\lib\net452\XPath2.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
<package id="AnyOf" version="0.3.0" targetFramework="net472" />
|
||||
<package id="Fare" version="2.2.1" targetFramework="net472" />
|
||||
<package id="Handlebars.Net" version="2.1.4" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Core" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.DynamicLinq" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Humanizer" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Json" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Random" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Xeger" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.XPath" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Core" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.DynamicLinq" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Humanizer" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Json" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Random" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.Xeger" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Handlebars.Net.Helpers.XPath" version="2.4.1.2" targetFramework="net472" />
|
||||
<package id="Humanizer" version="2.14.1" targetFramework="net472" />
|
||||
<package id="Humanizer.Core" version="2.14.1" targetFramework="net472" />
|
||||
<package id="Humanizer.Core.af" version="2.14.1" targetFramework="net472" />
|
||||
@@ -115,12 +115,12 @@
|
||||
<package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net472" />
|
||||
<package id="Microsoft.Extensions.Options.ConfigurationExtensions" version="2.2.0" targetFramework="net472" />
|
||||
<package id="Microsoft.Extensions.Primitives" version="5.0.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Abstractions" version="6.25.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.JsonWebTokens" version="6.25.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Logging" version="6.25.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Abstractions" version="7.2.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.JsonWebTokens" version="7.2.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Logging" version="7.2.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Protocols" version="6.12.2" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.12.2" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Tokens" version="6.25.0" targetFramework="net472" />
|
||||
<package id="Microsoft.IdentityModel.Tokens" version="7.2.0" targetFramework="net472" />
|
||||
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net472" />
|
||||
<package id="Namotion.Reflection" version="2.0.10" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
|
||||
@@ -136,10 +136,10 @@
|
||||
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net472" />
|
||||
<package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.IdentityModel.Tokens.Jwt" version="6.25.0" targetFramework="net472" />
|
||||
<package id="System.IdentityModel.Tokens.Jwt" version="6.34.0" targetFramework="net472" />
|
||||
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net472" />
|
||||
<package id="System.Linq.Dynamic.Core" version="1.3.1" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
|
||||
@@ -151,6 +151,6 @@
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
<package id="TinyMapper" version="3.0.3" targetFramework="net472" />
|
||||
<package id="XPath2" version="1.1.3" targetFramework="net472" />
|
||||
<package id="XPath2.Extensions" version="1.1.3" targetFramework="net472" />
|
||||
<package id="XPath2" version="1.1.4" targetFramework="net472" />
|
||||
<package id="XPath2.Extensions" version="1.1.4" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using WireMock.Logging;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
using WireMock.Settings;
|
||||
|
||||
namespace WireMock.Net.Console.Proxy.NETCoreApp2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var server = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
Urls = new[] { "http://localhost:9091", "https://localhost:9443" },
|
||||
StartAdminInterface = true,
|
||||
ReadStaticMappings = false,
|
||||
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
Url = "http://postman-echo.com/post",
|
||||
//ClientX509Certificate2ThumbprintOrSubjectName = "www.yourclientcertname.com OR yourcertificatethumbprint (only if the service you're proxying to requires it)",
|
||||
SaveMapping = true,
|
||||
SaveMappingToFile = false,
|
||||
ExcludedHeaders = new[] { "dnt", "Content-Length" }
|
||||
},
|
||||
Logger= new WireMockConsoleLogger()
|
||||
});
|
||||
|
||||
//server.LogEntriesChanged += (sender, eventRecordArgs) =>
|
||||
//{
|
||||
// System.Console.WriteLine(JsonConvert.SerializeObject(eventRecordArgs.NewItems, Formatting.Indented));
|
||||
//};
|
||||
|
||||
System.Console.WriteLine("Press any key to stop the server");
|
||||
System.Console.ReadKey();
|
||||
server.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:63377/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WireMock.Net.Console.Proxy.NETCoreApp2": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:63378/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<ApplicationIcon>../../resources/WireMock.Net-Logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -79,8 +79,8 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="XPath2, Version=1.1.3.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\XPath2.1.1.3\lib\net452\XPath2.dll</HintPath>
|
||||
<Reference Include="XPath2, Version=1.1.4.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\XPath2.1.1.4\lib\net452\XPath2.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net452" />
|
||||
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" requireReinstallation="true" />
|
||||
<package id="XPath2" version="1.1.3" targetFramework="net452" />
|
||||
<package id="XPath2" version="1.1.4" targetFramework="net48" />
|
||||
</packages>
|
||||
@@ -1,22 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WireMock.Net.WebApplication
|
||||
{
|
||||
public class App
|
||||
{
|
||||
private readonly IWireMockService _service;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public App(IWireMockService service, ILogger logger)
|
||||
{
|
||||
_service = service;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
_logger.LogInformation("WireMock.Net App running");
|
||||
_service.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace WireMock.Net.WebApplication
|
||||
{
|
||||
public interface IWireMockService
|
||||
{
|
||||
void Run();
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using WireMock.Settings;
|
||||
|
||||
namespace WireMock.Net.WebApplication
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// Create service collection
|
||||
var serviceCollection = new ServiceCollection();
|
||||
ConfigureServices(serviceCollection);
|
||||
|
||||
// Create service provider
|
||||
var serviceProvider = serviceCollection.BuildServiceProvider();
|
||||
|
||||
// Run app
|
||||
serviceProvider.GetService<App>().Run();
|
||||
}
|
||||
|
||||
private static void ConfigureServices(IServiceCollection serviceCollection)
|
||||
{
|
||||
// Build configuration
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddEnvironmentVariables() // <-- this is needed to to override settings via the Azure Portal App Settings
|
||||
.Build();
|
||||
|
||||
// Add LoggerFactory
|
||||
var factory = new LoggerFactory();
|
||||
serviceCollection.AddSingleton(factory
|
||||
.AddConsole(configuration.GetSection("Logging"))
|
||||
.AddDebug()
|
||||
.AddAzureWebAppDiagnostics()
|
||||
);
|
||||
|
||||
serviceCollection.AddSingleton(factory.CreateLogger("WireMock.Net Logger"));
|
||||
|
||||
// Add access to generic IConfigurationRoot
|
||||
serviceCollection.AddSingleton(configuration);
|
||||
|
||||
// Add access to WireMockServerSettings
|
||||
var settings = configuration.GetSection("WireMockServerSettings").Get<WireMockServerSettings>();
|
||||
serviceCollection.AddSingleton<WireMockServerSettings>(settings);
|
||||
|
||||
// Add services
|
||||
serviceCollection.AddTransient<IWireMockService, WireMockService>();
|
||||
|
||||
// Add app
|
||||
serviceCollection.AddTransient<App>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:60097/",
|
||||
"sslPort": 44321
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchUrl": "__admin/settings",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WireMock.Net.WebApplication": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "__admin/settings",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:56514/"
|
||||
},
|
||||
"IIS": {
|
||||
"commandName": "IIS",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
|
||||
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
|
||||
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
|
||||
<RootNamespace>WireMock.Net.WebApplication</RootNamespace>
|
||||
<UserSecretsId>efcf4a18-fd7c-4622-825d-336d65290599</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0'">
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1'">
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,83 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using WireMock.Admin.Requests;
|
||||
using WireMock.Logging;
|
||||
using WireMock.Server;
|
||||
using WireMock.Settings;
|
||||
|
||||
namespace WireMock.Net.WebApplication
|
||||
{
|
||||
public class WireMockService : IWireMockService
|
||||
{
|
||||
private static int sleepTime = 30000;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly WireMockServerSettings _settings;
|
||||
|
||||
private class Logger : IWireMockLogger
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public Logger(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Debug(string formatString, params object[] args)
|
||||
{
|
||||
_logger.LogDebug(formatString, args);
|
||||
}
|
||||
|
||||
public void Info(string formatString, params object[] args)
|
||||
{
|
||||
_logger.LogInformation(formatString, args);
|
||||
}
|
||||
|
||||
public void Warn(string formatString, params object[] args)
|
||||
{
|
||||
_logger.LogWarning(formatString, args);
|
||||
}
|
||||
|
||||
public void Error(string formatString, params object[] args)
|
||||
{
|
||||
_logger.LogError(formatString, args);
|
||||
}
|
||||
|
||||
public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminrequest)
|
||||
{
|
||||
string message = JsonConvert.SerializeObject(logEntryModel, Formatting.Indented);
|
||||
_logger.LogDebug("Admin[{0}] {1}", isAdminrequest, message);
|
||||
}
|
||||
|
||||
public void Error(string formatString, Exception exception)
|
||||
{
|
||||
_logger.LogError(formatString, exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public WireMockService(ILogger logger, WireMockServerSettings settings)
|
||||
{
|
||||
_logger = logger;
|
||||
_settings = settings;
|
||||
|
||||
_settings.Logger = new Logger(logger);
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
_logger.LogInformation("WireMock.Net server starting");
|
||||
|
||||
WireMockServer.Start(_settings);
|
||||
|
||||
_logger.LogInformation($"WireMock.Net server settings {JsonConvert.SerializeObject(_settings)}");
|
||||
|
||||
while (true)
|
||||
{
|
||||
_logger.LogInformation("WireMock.Net server running");
|
||||
Thread.Sleep(sleepTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"Debug": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug"
|
||||
}
|
||||
},
|
||||
"Console": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug"
|
||||
}
|
||||
}
|
||||
},
|
||||
"WireMockServerSettings": {
|
||||
"AdminUsername": "a",
|
||||
"AdminPassword": "b",
|
||||
"StartAdminInterface": true
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"defaultProvider": "cdnjs",
|
||||
"libraries": []
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Running in IIS
|
||||
|
||||
Follow these links / steps:
|
||||
* https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications-with-IIS
|
||||
* https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?view=aspnetcore-2.1
|
||||
* Create a `web.config` file
|
||||
|
||||
## IIS Sites
|
||||

|
||||
|
||||
## App Pool settings
|
||||

|
||||
|
||||
## Publish Profiles
|
||||
Two example publish profiles are created:
|
||||
* [IIS Localhost 1](./Properties/PublishProfiles/IIS%20Localhost%201.pubxml)
|
||||
* [IIS Localhost 2](./Properties/PublishProfiles/IIS%20Localhost%202.pubxml)
|
||||
|
||||
## Debugging
|
||||
Select the debug "IIS" if you want to debug in IIS.
|
||||

|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<!--
|
||||
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
|
||||
-->
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using WireMock.Admin.Settings;
|
||||
|
||||
namespace WireMock.Admin.Mappings;
|
||||
|
||||
@@ -103,6 +104,11 @@ public class ResponseModel
|
||||
/// </summary>
|
||||
public string? ProxyUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the Proxy Url Replace Settings.
|
||||
/// </summary>
|
||||
public ProxyUrlReplaceSettingsModel? ProxyUrlReplaceSettings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The client X509Certificate2 Thumbprint or SubjectName to use.
|
||||
/// </summary>
|
||||
|
||||
@@ -15,12 +15,12 @@ public class LogEntryModel
|
||||
/// <summary>
|
||||
/// The request.
|
||||
/// </summary>
|
||||
public LogRequestModel Request { get; set; }
|
||||
public required LogRequestModel Request { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The response.
|
||||
/// </summary>
|
||||
public LogResponseModel Response { get; set; }
|
||||
public required LogResponseModel Response { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The mapping unique identifier.
|
||||
|
||||
@@ -70,7 +70,17 @@ public class ProxyAndRecordSettingsModel
|
||||
public bool AppendGuidToSavedMappingFile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the Replace Settings
|
||||
/// Set prefix for saved mapping file.
|
||||
/// </summary>
|
||||
public string PrefixForSavedMappingFile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the Replace Settings.
|
||||
/// </summary>
|
||||
public ProxyUrlReplaceSettingsModel? ReplaceSettings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Proxy all Api calls, irrespective of any condition
|
||||
/// </summary>
|
||||
public bool ProxyAll { get; set; } = false;
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
namespace WireMock.Admin.Settings
|
||||
namespace WireMock.Admin.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// WebProxySettings
|
||||
/// </summary>
|
||||
[FluentBuilder.AutoGenerateBuilder]
|
||||
public class WebProxySettingsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// WebProxySettings
|
||||
/// A string instance that contains the address of the proxy server.
|
||||
/// </summary>
|
||||
[FluentBuilder.AutoGenerateBuilder]
|
||||
public class WebProxySettingsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// A string instance that contains the address of the proxy server.
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
public string Address { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// The user name associated with the credentials.
|
||||
/// </summary>
|
||||
public string? UserName { get; set; }
|
||||
/// <summary>
|
||||
/// The user name associated with the credentials.
|
||||
/// </summary>
|
||||
public string? UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The password for the user name associated with the credentials.
|
||||
/// </summary>
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The password for the user name associated with the credentials.
|
||||
/// </summary>
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public interface IWireMockServer : IDisposable
|
||||
void RemoveAuthentication();
|
||||
|
||||
/// <summary>
|
||||
/// Resets LogEntries and Mappings.
|
||||
/// Resets LogEntries, Mappings and Scenarios.
|
||||
/// </summary>
|
||||
void Reset();
|
||||
|
||||
|
||||
@@ -7,19 +7,16 @@ public enum ReplaceNodeOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Try to evaluate a templated value.
|
||||
/// In case this is valid, return the value and if the value can be converted to a primitive type, use that value.
|
||||
/// In case this is valid, return the value and if the value can be converted to a supported (primitive) type, use that value.
|
||||
///
|
||||
/// [Default behaviour]
|
||||
/// </summary>
|
||||
EvaluateAndTryToConvert = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Try to evaluate a templated value.
|
||||
/// In case this is valid, return the value, else fallback to the parse behavior.
|
||||
/// Parse templated string to a templated string.
|
||||
/// For example: keep a templated string value (which is always the case) as a string value.
|
||||
/// </summary>
|
||||
Evaluate = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Parse templated string to a templated string.
|
||||
/// (keep a templated string value as string value).
|
||||
/// </summary>
|
||||
Parse = 2
|
||||
EvaluateAndKeep = Evaluate
|
||||
}
|
||||
@@ -43,6 +43,11 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
<PackageReference Include="PolySharp" Version="1.14.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) and '$(TargetFramework)' != 'netstandard1.0'">
|
||||
|
||||
@@ -125,20 +125,27 @@ public partial class WireMockAssertions
|
||||
}
|
||||
|
||||
[CustomAssertion]
|
||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string value, string because = "", params object[] becauseArgs)
|
||||
=> WithHeader(expectedKey, new[] { value }, because, becauseArgs);
|
||||
|
||||
[CustomAssertion]
|
||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
||||
public AndConstraint<WireMockAssertions> WitHeaderKey(string expectedKey, string because = "", params object[] becauseArgs)
|
||||
{
|
||||
using (new AssertionScope("headers from requests sent"))
|
||||
{
|
||||
_headers.Select(h => h.Key).Should().Contain(expectedKey, because, becauseArgs);
|
||||
}
|
||||
|
||||
return new AndConstraint<WireMockAssertions>(this);
|
||||
}
|
||||
|
||||
[CustomAssertion]
|
||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string value, string because = "", params object[] becauseArgs)
|
||||
=> WithHeader(expectedKey, new[] { value }, because, becauseArgs);
|
||||
|
||||
[CustomAssertion]
|
||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
||||
{
|
||||
using (new AssertionScope($"header \"{expectedKey}\" from requests sent with value(s)"))
|
||||
{
|
||||
var matchingHeaderValues = _headers.Where(h => h.Key == expectedKey).SelectMany(h => h.Value.ToArray()).ToArray();
|
||||
var matchingHeaderValues = _headers.Where(h => h.Key == expectedKey).SelectMany(h => h.Value.ToArray())
|
||||
.ToArray();
|
||||
|
||||
if (expectedValues.Length == 1)
|
||||
{
|
||||
@@ -157,6 +164,45 @@ public partial class WireMockAssertions
|
||||
return new AndConstraint<WireMockAssertions>(this);
|
||||
}
|
||||
|
||||
[CustomAssertion]
|
||||
public AndConstraint<WireMockAssertions> WithoutHeaderKey(string unexpectedKey, string because = "", params object[] becauseArgs)
|
||||
{
|
||||
using (new AssertionScope("headers from requests sent"))
|
||||
{
|
||||
_headers.Select(h => h.Key).Should().NotContain(unexpectedKey, because, becauseArgs);
|
||||
}
|
||||
|
||||
return new AndConstraint<WireMockAssertions>(this);
|
||||
}
|
||||
|
||||
[CustomAssertion]
|
||||
public AndConstraint<WireMockAssertions> WithoutHeader(string unexpectedKey, string value, string because = "", params object[] becauseArgs)
|
||||
=> WithoutHeader(unexpectedKey, new[] { value }, because, becauseArgs);
|
||||
|
||||
[CustomAssertion]
|
||||
public AndConstraint<WireMockAssertions> WithoutHeader(string unexpectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
||||
{
|
||||
using (new AssertionScope($"header \"{unexpectedKey}\" from requests sent with value(s)"))
|
||||
{
|
||||
var matchingHeaderValues = _headers.Where(h => h.Key == unexpectedKey).SelectMany(h => h.Value.ToArray()).ToArray();
|
||||
|
||||
if (expectedValues.Length == 1)
|
||||
{
|
||||
matchingHeaderValues.Should().NotContain(expectedValues.First(), because, becauseArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
var trimmedHeaderValues = string.Join(",", matchingHeaderValues.Select(x => x)).Split(',').Select(x => x.Trim()).ToList();
|
||||
foreach (var expectedValue in expectedValues)
|
||||
{
|
||||
trimmedHeaderValues.Should().NotContain(expectedValue, because, becauseArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new AndConstraint<WireMockAssertions>(this);
|
||||
}
|
||||
|
||||
private (Func<IReadOnlyList<IRequestMessage>, IReadOnlyList<IRequestMessage>> Filter, Func<IReadOnlyList<IRequestMessage>, bool> Condition) BuildFilterAndCondition(Func<IRequestMessage, bool> predicate)
|
||||
{
|
||||
Func<IReadOnlyList<IRequestMessage>, IReadOnlyList<IRequestMessage>> filter = requests => requests.Where(predicate).ToList();
|
||||
|
||||
@@ -178,7 +178,7 @@ public interface IWireMockAdminApi
|
||||
/// Get a request based on the guid
|
||||
/// </summary>
|
||||
/// <param name="guid">The Guid</param>
|
||||
/// <returns>MappingModel</returns>
|
||||
/// <returns>LogEntryModel</returns>
|
||||
/// <param name="cancellationToken">The optional cancellationToken.</param>
|
||||
[Get("requests/{guid}")]
|
||||
Task<LogEntryModel> GetRequestAsync([Path] Guid guid, CancellationToken cancellationToken = default);
|
||||
@@ -192,7 +192,7 @@ public interface IWireMockAdminApi
|
||||
Task<StatusModel> DeleteRequestAsync([Path] Guid guid, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Find a request based on the criteria
|
||||
/// Find requests based on the criteria (<see cref="RequestModel"/>)
|
||||
/// </summary>
|
||||
/// <param name="model">The RequestModel</param>
|
||||
/// <param name="cancellationToken">The optional cancellationToken.</param>
|
||||
@@ -200,6 +200,14 @@ public interface IWireMockAdminApi
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<IList<LogEntryModel>> FindRequestsAsync([Body] RequestModel model, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Find requests based on the Mapping Guid.
|
||||
/// </summary>
|
||||
/// <param name="mappingGuid">The Mapping Guid</param>
|
||||
/// <param name="cancellationToken">The optional cancellationToken.</param>
|
||||
[Get("requests/find")]
|
||||
Task<IList<LogEntryModel>> FindRequestsByMappingGuidAsync([Query] Guid mappingGuid, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Get all scenarios
|
||||
/// </summary>
|
||||
@@ -296,4 +304,4 @@ public interface IWireMockAdminApi
|
||||
/// <param name="cancellationToken">The optional cancellationToken.</param>
|
||||
[Post("openapi/save")]
|
||||
Task<StatusModel> OpenApiSaveAsync([Body] string text, CancellationToken cancellationToken = default);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,12 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Stef.Validation" Version="0.1.1" />
|
||||
<PackageReference Include="Testcontainers" Version="3.6.0" />
|
||||
<PackageReference Include="Testcontainers" Version="[3.7.0]" />
|
||||
<PackageReference Include="JetBrains.Annotations" VersionOverride="2022.3.1" PrivateAssets="All" Version="2023.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WireMock.Net.RestClient\WireMock.Net.RestClient.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Http\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -16,10 +16,7 @@ public sealed class WireMockConfiguration : ContainerConfiguration
|
||||
|
||||
public bool HasBasicAuthentication => !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password);
|
||||
|
||||
public WireMockConfiguration(
|
||||
string? username = null,
|
||||
string? password = null
|
||||
)
|
||||
public WireMockConfiguration(string? username = null, string? password = null)
|
||||
{
|
||||
Username = username;
|
||||
Password = password;
|
||||
|
||||
@@ -25,6 +25,11 @@ public sealed class WireMockContainerBuilder : ContainerBuilder<WireMockContaine
|
||||
|
||||
private readonly Lazy<Task<bool>> _isWindowsAsLazy = new(async () =>
|
||||
{
|
||||
if (TestcontainersSettings.OS.DockerEndpointAuthConfig == null)
|
||||
{
|
||||
throw new InvalidOperationException($"The {nameof(TestcontainersSettings.OS.DockerEndpointAuthConfig)} is null. Check if Docker is started.");
|
||||
}
|
||||
|
||||
using var dockerClientConfig = TestcontainersSettings.OS.DockerEndpointAuthConfig.GetDockerClientConfiguration();
|
||||
using var dockerClient = dockerClientConfig.CreateClient();
|
||||
|
||||
|
||||
@@ -77,4 +77,6 @@ internal interface IWireMockMiddlewareOptions
|
||||
bool? DoNotSaveDynamicResponseInLogEntry { get; set; }
|
||||
|
||||
QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; }
|
||||
|
||||
public bool ProxyAll { get; set; }
|
||||
}
|
||||
@@ -95,4 +95,7 @@ internal class WireMockMiddlewareOptions : IWireMockMiddlewareOptions
|
||||
|
||||
/// <inheritdoc />
|
||||
public QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ProxyAll { get; set; }
|
||||
}
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using JsonConverter.Abstractions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Util;
|
||||
|
||||
namespace WireMock.RequestBuilders;
|
||||
|
||||
@@ -29,5 +29,5 @@ public interface ITransformResponseBuilder : IDelayResponseBuilder
|
||||
/// <returns>
|
||||
/// The <see cref="IResponseBuilder"/>.
|
||||
/// </returns>
|
||||
IResponseBuilder WithTransformer(TransformerType transformerType = TransformerType.Handlebars, bool transformContentFromBodyAsFile = false, ReplaceNodeOptions options = ReplaceNodeOptions.Evaluate);
|
||||
IResponseBuilder WithTransformer(TransformerType transformerType = TransformerType.Handlebars, bool transformContentFromBodyAsFile = false, ReplaceNodeOptions options = ReplaceNodeOptions.EvaluateAndTryToConvert);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public partial class Response : IResponseBuilder
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithTransformer(TransformerType transformerType, bool transformContentFromBodyAsFile = false, ReplaceNodeOptions options = ReplaceNodeOptions.Evaluate)
|
||||
public IResponseBuilder WithTransformer(TransformerType transformerType, bool transformContentFromBodyAsFile = false, ReplaceNodeOptions options = ReplaceNodeOptions.EvaluateAndTryToConvert)
|
||||
{
|
||||
UseTransformer = true;
|
||||
TransformerType = transformerType;
|
||||
|
||||
@@ -373,9 +373,11 @@ internal class MappingConverter
|
||||
mappingModel.Response.UseTransformerForBodyAsFile = null;
|
||||
mappingModel.Response.TransformerReplaceNodeOptions = null;
|
||||
mappingModel.Response.BodyEncoding = null;
|
||||
mappingModel.Response.ProxyUrl = response.ProxyAndRecordSettings.Url;
|
||||
mappingModel.Response.Fault = null;
|
||||
mappingModel.Response.WebProxy = MapWebProxy(response.ProxyAndRecordSettings.WebProxySettings);
|
||||
|
||||
mappingModel.Response.WebProxy = TinyMapperUtils.Instance.Map(response.ProxyAndRecordSettings.WebProxySettings);
|
||||
mappingModel.Response.ProxyUrl = response.ProxyAndRecordSettings.Url;
|
||||
mappingModel.Response.ProxyUrlReplaceSettings = TinyMapperUtils.Instance.Map(response.ProxyAndRecordSettings.ReplaceSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -509,16 +511,6 @@ internal class MappingConverter
|
||||
return values is { } ? string.Join(", ", values.Select(ToCSharpStringLiteral)) : ToCSharpStringLiteral(defaultValue);
|
||||
}
|
||||
|
||||
private static WebProxyModel? MapWebProxy(WebProxySettings? settings)
|
||||
{
|
||||
return settings != null ? new WebProxyModel
|
||||
{
|
||||
Address = settings.Address,
|
||||
UserName = settings.UserName,
|
||||
Password = settings.Password
|
||||
} : null;
|
||||
}
|
||||
|
||||
private static IDictionary<string, object> MapHeaders(IDictionary<string, WireMockList<string>> dictionary)
|
||||
{
|
||||
var newDictionary = new Dictionary<string, object>();
|
||||
|
||||
48
src/WireMock.Net/Serialization/MappingFileNameSanitizer.cs
Normal file
48
src/WireMock.Net/Serialization/MappingFileNameSanitizer.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Stef.Validation;
|
||||
using WireMock.Settings;
|
||||
|
||||
namespace WireMock.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Creates sanitized file names for mappings
|
||||
/// </summary>
|
||||
public class MappingFileNameSanitizer
|
||||
{
|
||||
private const char ReplaceChar = '_';
|
||||
|
||||
private readonly WireMockServerSettings _settings;
|
||||
|
||||
public MappingFileNameSanitizer(WireMockServerSettings settings)
|
||||
{
|
||||
_settings = Guard.NotNull(settings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates sanitized file names for mappings
|
||||
/// </summary>
|
||||
public string BuildSanitizedFileName(IMapping mapping)
|
||||
{
|
||||
string name;
|
||||
if (!string.IsNullOrEmpty(mapping.Title))
|
||||
{
|
||||
// remove 'Proxy Mapping for ' and an extra space character after the HTTP request method
|
||||
name = mapping.Title.Replace(ProxyAndRecordSettings.DefaultPrefixForSavedMappingFile, "").Replace(' '.ToString(), string.Empty);
|
||||
if (_settings.ProxyAndRecordSettings?.AppendGuidToSavedMappingFile == true)
|
||||
{
|
||||
name += $"{ReplaceChar}{mapping.Guid}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = mapping.Guid.ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_settings.ProxyAndRecordSettings?.PrefixForSavedMappingFile))
|
||||
{
|
||||
name = $"{_settings.ProxyAndRecordSettings.PrefixForSavedMappingFile}{ReplaceChar}{name}";
|
||||
}
|
||||
return $"{Path.GetInvalidFileNameChars().Aggregate(name, (current, c) => current.Replace(c, ReplaceChar))}.json";
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,13 @@ internal class MappingToFileSaver
|
||||
{
|
||||
private readonly WireMockServerSettings _settings;
|
||||
private readonly MappingConverter _mappingConverter;
|
||||
private readonly MappingFileNameSanitizer _fileNameSanitizer;
|
||||
|
||||
public MappingToFileSaver(WireMockServerSettings settings, MappingConverter mappingConverter)
|
||||
{
|
||||
_settings = Guard.NotNull(settings);
|
||||
_mappingConverter = Guard.NotNull(mappingConverter);
|
||||
_fileNameSanitizer = new MappingFileNameSanitizer(settings);
|
||||
}
|
||||
|
||||
public void SaveMappingsToFile(IMapping[] mappings, string? folder = null)
|
||||
@@ -42,7 +44,7 @@ internal class MappingToFileSaver
|
||||
|
||||
var model = _mappingConverter.ToMappingModel(mapping);
|
||||
|
||||
var filename = BuildSanitizedFileName(mapping);
|
||||
var filename = _fileNameSanitizer.BuildSanitizedFileName(mapping);
|
||||
var path = Path.Combine(folder, filename);
|
||||
|
||||
Save(model, path);
|
||||
@@ -54,23 +56,4 @@ internal class MappingToFileSaver
|
||||
|
||||
_settings.FileSystemHandler.WriteMappingFile(path, JsonConvert.SerializeObject(value, JsonSerializationConstants.JsonSerializerSettingsDefault));
|
||||
}
|
||||
|
||||
private string BuildSanitizedFileName(IMapping mapping, char replaceChar = '_')
|
||||
{
|
||||
string name;
|
||||
if (!string.IsNullOrEmpty(mapping.Title))
|
||||
{
|
||||
name = mapping.Title!;
|
||||
if (_settings.ProxyAndRecordSettings?.AppendGuidToSavedMappingFile == true)
|
||||
{
|
||||
name += $"{replaceChar}{mapping.Guid}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = mapping.Guid.ToString();
|
||||
}
|
||||
|
||||
return $"{Path.GetInvalidFileNameChars().Aggregate(name, (current, c) => current.Replace(c, replaceChar))}.json";
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ internal static class WebhookMapper
|
||||
|
||||
if (!Enum.TryParse<ReplaceNodeOptions>(model.Request.TransformerReplaceNodeOptions, out var option))
|
||||
{
|
||||
option = ReplaceNodeOptions.Evaluate;
|
||||
option = ReplaceNodeOptions.EvaluateAndTryToConvert;
|
||||
}
|
||||
webhook.Request.TransformerReplaceNodeOptions = option;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ public partial class WireMockServer
|
||||
|
||||
// __admin/requests/find
|
||||
Given(Request.Create().WithPath(AdminRequests + "/find").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsFind));
|
||||
Given(Request.Create().WithPath(AdminRequests + "/find").UsingGet().WithParam("mappingGuid", new NotNullOrEmptyMatcher())).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsFindByMappingGuid));
|
||||
|
||||
// __admin/scenarios
|
||||
Given(Request.Create().WithPath(AdminScenarios).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenariosGet));
|
||||
@@ -436,7 +437,7 @@ public partial class WireMockServer
|
||||
var mappingModels = DeserializeRequestMessageToArray<MappingModel>(requestMessage);
|
||||
if (mappingModels.Length == 1)
|
||||
{
|
||||
Guid? guid = ConvertMappingAndRegisterAsRespondProvider(mappingModels[0]);
|
||||
var guid = ConvertMappingAndRegisterAsRespondProvider(mappingModels[0]);
|
||||
return ResponseMessageBuilder.Create(201, "Mapping added", guid);
|
||||
}
|
||||
|
||||
@@ -535,7 +536,7 @@ public partial class WireMockServer
|
||||
{
|
||||
if (TryParseGuidFromRequestMessage(requestMessage, out var guid))
|
||||
{
|
||||
var entry = LogEntries.FirstOrDefault(r => !r.RequestMessage.Path.StartsWith("/__admin/") && r.Guid == guid);
|
||||
var entry = LogEntries.SingleOrDefault(r => !r.RequestMessage.Path.StartsWith("/__admin/") && r.Guid == guid);
|
||||
if (entry is { })
|
||||
{
|
||||
var model = new LogEntryMapper(_options).Map(entry);
|
||||
@@ -600,6 +601,22 @@ public partial class WireMockServer
|
||||
|
||||
return ToJson(result);
|
||||
}
|
||||
|
||||
private IResponseMessage RequestsFindByMappingGuid(IRequestMessage requestMessage)
|
||||
{
|
||||
if (requestMessage.Query != null &&
|
||||
requestMessage.Query.TryGetValue("mappingGuid", out var value) &&
|
||||
Guid.TryParse(value.ToString(), out var mappingGuid)
|
||||
)
|
||||
{
|
||||
var logEntries = LogEntries.Where(le => !le.RequestMessage.Path.StartsWith("/__admin/") && le.MappingGuid == mappingGuid);
|
||||
var logEntryMapper = new LogEntryMapper(_options);
|
||||
var result = logEntries.Select(logEntryMapper.Map);
|
||||
return ToJson(result);
|
||||
}
|
||||
|
||||
return ResponseMessageBuilder.Create(HttpStatusCode.BadRequest);
|
||||
}
|
||||
#endregion Requests/find
|
||||
|
||||
#region Scenarios
|
||||
@@ -812,4 +829,4 @@ public partial class WireMockServer
|
||||
var singleResult = ((JObject)value).ToObject<T>();
|
||||
return new[] { singleResult! };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,14 +264,16 @@ public partial class WireMockServer
|
||||
transformerType = TransformerType.Handlebars;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse<ReplaceNodeOptions>(responseModel.TransformerReplaceNodeOptions, out var option))
|
||||
if (!Enum.TryParse<ReplaceNodeOptions>(responseModel.TransformerReplaceNodeOptions, out var replaceNodeOptions))
|
||||
{
|
||||
option = ReplaceNodeOptions.Evaluate;
|
||||
replaceNodeOptions = ReplaceNodeOptions.EvaluateAndTryToConvert;
|
||||
}
|
||||
|
||||
responseBuilder = responseBuilder.WithTransformer(
|
||||
transformerType,
|
||||
responseModel.UseTransformerForBodyAsFile == true,
|
||||
option);
|
||||
replaceNodeOptions
|
||||
);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(responseModel.ProxyUrl))
|
||||
@@ -280,12 +282,8 @@ public partial class WireMockServer
|
||||
{
|
||||
Url = responseModel.ProxyUrl!,
|
||||
ClientX509Certificate2ThumbprintOrSubjectName = responseModel.X509Certificate2ThumbprintOrSubjectName,
|
||||
WebProxySettings = responseModel.WebProxy != null ? new WebProxySettings
|
||||
{
|
||||
Address = responseModel.WebProxy.Address,
|
||||
UserName = responseModel.WebProxy.UserName,
|
||||
Password = responseModel.WebProxy.Password
|
||||
} : null
|
||||
WebProxySettings = TinyMapperUtils.Instance.Map(responseModel.WebProxy),
|
||||
ReplaceSettings = TinyMapperUtils.Instance.Map(responseModel.ProxyUrlReplaceSettings)
|
||||
};
|
||||
|
||||
return responseBuilder.WithProxy(proxyAndRecordSettings);
|
||||
|
||||
@@ -10,7 +10,7 @@ using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Util;
|
||||
using Stef.Validation;
|
||||
using OrgMappings = WireMock.Org.Abstractions.Mappings;
|
||||
using OrgMapping = WireMock.Org.Abstractions.Mapping;
|
||||
|
||||
namespace WireMock.Server;
|
||||
|
||||
@@ -25,14 +25,14 @@ public partial class WireMockServer
|
||||
{
|
||||
Guard.NotNull(path, nameof(path));
|
||||
|
||||
string filenameWithoutExtension = Path.GetFileNameWithoutExtension(path);
|
||||
var filenameWithoutExtension = Path.GetFileNameWithoutExtension(path);
|
||||
|
||||
if (FileHelper.TryReadMappingFileWithRetryAndDelay(_settings.FileSystemHandler, path, out var value))
|
||||
{
|
||||
var mappings = DeserializeJsonToArray<OrgMappings>(value);
|
||||
var mappings = DeserializeJsonToArray<OrgMapping>(value);
|
||||
foreach (var mapping in mappings)
|
||||
{
|
||||
if (mappings.Length == 1 && Guid.TryParse(filenameWithoutExtension, out Guid guidFromFilename))
|
||||
if (mappings.Length == 1 && Guid.TryParse(filenameWithoutExtension, out var guidFromFilename))
|
||||
{
|
||||
ConvertWireMockOrgMappingAndRegisterAsRespondProvider(mapping, guidFromFilename, path);
|
||||
}
|
||||
@@ -48,10 +48,10 @@ public partial class WireMockServer
|
||||
{
|
||||
try
|
||||
{
|
||||
var mappingModels = DeserializeRequestMessageToArray<OrgMappings>(requestMessage);
|
||||
var mappingModels = DeserializeRequestMessageToArray<OrgMapping>(requestMessage);
|
||||
if (mappingModels.Length == 1)
|
||||
{
|
||||
Guid? guid = ConvertWireMockOrgMappingAndRegisterAsRespondProvider(mappingModels[0]);
|
||||
var guid = ConvertWireMockOrgMappingAndRegisterAsRespondProvider(mappingModels[0]);
|
||||
return ResponseMessageBuilder.Create(201, "Mapping added", guid);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public partial class WireMockServer
|
||||
}
|
||||
}
|
||||
|
||||
private Guid? ConvertWireMockOrgMappingAndRegisterAsRespondProvider(OrgMappings mapping, Guid? guid = null, string? path = null)
|
||||
private Guid? ConvertWireMockOrgMappingAndRegisterAsRespondProvider(Org.Abstractions.Mapping mapping, Guid? guid = null, string? path = null)
|
||||
{
|
||||
var requestBuilder = Request.Create();
|
||||
|
||||
@@ -159,7 +159,7 @@ public partial class WireMockServer
|
||||
}
|
||||
}
|
||||
|
||||
IResponseBuilder responseBuilder = Response.Create();
|
||||
var responseBuilder = Response.Create();
|
||||
|
||||
var response = mapping.Response;
|
||||
if (response != null)
|
||||
|
||||
@@ -31,6 +31,11 @@ public partial class WireMockServer
|
||||
proxyRespondProvider.AtPriority(WireMockConstants.ProxyPriority);
|
||||
}
|
||||
|
||||
if(settings.ProxyAndRecordSettings.ProxyAll)
|
||||
{
|
||||
proxyRespondProvider.AtPriority(int.MinValue);
|
||||
}
|
||||
|
||||
proxyRespondProvider.RespondWith(new ProxyAsyncResponseProvider(ProxyAndRecordAsync, settings));
|
||||
}
|
||||
|
||||
|
||||
@@ -427,6 +427,8 @@ public partial class WireMockServer : IWireMockServer
|
||||
{
|
||||
ResetLogEntries();
|
||||
|
||||
ResetScenarios();
|
||||
|
||||
ResetMappings();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@ namespace WireMock.Settings;
|
||||
/// </summary>
|
||||
public class ProxyAndRecordSettings : HttpClientSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Default prefix value for saved mapping file
|
||||
/// </summary>
|
||||
public const string DefaultPrefixForSavedMappingFile = "Proxy Mapping for ";
|
||||
|
||||
/// <summary>
|
||||
/// The URL to proxy.
|
||||
/// </summary>
|
||||
@@ -94,4 +99,15 @@ public class ProxyAndRecordSettings : HttpClientSettings
|
||||
/// Append an unique GUID to the filename from the saved mapping file.
|
||||
/// </summary>
|
||||
public bool AppendGuidToSavedMappingFile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set prefix for saved mapping file.
|
||||
/// </summary>
|
||||
public string PrefixForSavedMappingFile { get; set; } = DefaultPrefixForSavedMappingFile;
|
||||
|
||||
/// <summary>
|
||||
/// Proxy all Api calls, irrespective of any condition
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public bool ProxyAll { get; set; }
|
||||
}
|
||||
@@ -41,25 +41,25 @@ public static class WireMockServerSettingsParser
|
||||
{
|
||||
AdminAzureADAudience = parser.GetStringValue(nameof(WireMockServerSettings.AdminAzureADAudience)),
|
||||
AdminAzureADTenant = parser.GetStringValue(nameof(WireMockServerSettings.AdminAzureADTenant)),
|
||||
AdminPassword = parser.GetStringValue("AdminPassword"),
|
||||
AdminUsername = parser.GetStringValue("AdminUsername"),
|
||||
AllowBodyForAllHttpMethods = parser.GetBoolValue("AllowBodyForAllHttpMethods"),
|
||||
AllowCSharpCodeMatcher = parser.GetBoolValue("AllowCSharpCodeMatcher"),
|
||||
AllowOnlyDefinedHttpStatusCodeInResponse = parser.GetBoolValue("AllowOnlyDefinedHttpStatusCodeInResponse"),
|
||||
AllowPartialMapping = parser.GetBoolValue("AllowPartialMapping"),
|
||||
DisableJsonBodyParsing = parser.GetBoolValue("DisableJsonBodyParsing"),
|
||||
AdminPassword = parser.GetStringValue(nameof(WireMockServerSettings.AdminPassword)),
|
||||
AdminUsername = parser.GetStringValue(nameof(WireMockServerSettings.AdminUsername)),
|
||||
AllowBodyForAllHttpMethods = parser.GetBoolValue(nameof(WireMockServerSettings.AllowBodyForAllHttpMethods)),
|
||||
AllowCSharpCodeMatcher = parser.GetBoolValue(nameof(WireMockServerSettings.AllowCSharpCodeMatcher)),
|
||||
AllowOnlyDefinedHttpStatusCodeInResponse = parser.GetBoolValue(nameof(WireMockServerSettings.AllowOnlyDefinedHttpStatusCodeInResponse)),
|
||||
AllowPartialMapping = parser.GetBoolValue(nameof(WireMockServerSettings.AllowPartialMapping)),
|
||||
DisableJsonBodyParsing = parser.GetBoolValue(nameof(WireMockServerSettings.DisableJsonBodyParsing)),
|
||||
DisableRequestBodyDecompressing = parser.GetBoolValue(nameof(WireMockServerSettings.DisableRequestBodyDecompressing)),
|
||||
DisableDeserializeFormUrlEncoded = parser.GetBoolValue(nameof(WireMockServerSettings.DisableDeserializeFormUrlEncoded)),
|
||||
HandleRequestsSynchronously = parser.GetBoolValue("HandleRequestsSynchronously"),
|
||||
MaxRequestLogCount = parser.GetIntValue("MaxRequestLogCount"),
|
||||
ReadStaticMappings = parser.GetBoolValue("ReadStaticMappings"),
|
||||
RequestLogExpirationDuration = parser.GetIntValue("RequestLogExpirationDuration"),
|
||||
HandleRequestsSynchronously = parser.GetBoolValue(nameof(WireMockServerSettings.HandleRequestsSynchronously)),
|
||||
MaxRequestLogCount = parser.GetIntValue(nameof(WireMockServerSettings.MaxRequestLogCount)),
|
||||
ReadStaticMappings = parser.GetBoolValue(nameof(WireMockServerSettings.ReadStaticMappings)),
|
||||
RequestLogExpirationDuration = parser.GetIntValue(nameof(WireMockServerSettings.RequestLogExpirationDuration)),
|
||||
SaveUnmatchedRequests = parser.GetBoolValue(nameof(WireMockServerSettings.SaveUnmatchedRequests)),
|
||||
StartAdminInterface = parser.GetBoolValue("StartAdminInterface", true),
|
||||
StartAdminInterface = parser.GetBoolValue(nameof(WireMockServerSettings.StartAdminInterface), true),
|
||||
StartTimeout = parser.GetIntValue(nameof(WireMockServerSettings.StartTimeout), WireMockServerSettings.DefaultStartTimeout),
|
||||
UseRegexExtended = parser.GetBoolValue(nameof(WireMockServerSettings.UseRegexExtended), true),
|
||||
WatchStaticMappings = parser.GetBoolValue("WatchStaticMappings"),
|
||||
WatchStaticMappingsInSubdirectories = parser.GetBoolValue("WatchStaticMappingsInSubdirectories"),
|
||||
WatchStaticMappings = parser.GetBoolValue(nameof(WireMockServerSettings.WatchStaticMappings)),
|
||||
WatchStaticMappingsInSubdirectories = parser.GetBoolValue(nameof(WireMockServerSettings.WatchStaticMappingsInSubdirectories)),
|
||||
HostingScheme = parser.GetEnumValue<HostingScheme>(nameof(WireMockServerSettings.HostingScheme)),
|
||||
DoNotSaveDynamicResponseInLogEntry = parser.GetBoolValue(nameof(WireMockServerSettings.DoNotSaveDynamicResponseInLogEntry)),
|
||||
QueryParameterMultipleValueSupport = parser.GetEnumValue<QueryParameterMultipleValueSupport>(nameof(WireMockServerSettings.QueryParameterMultipleValueSupport)),
|
||||
@@ -110,22 +110,24 @@ public static class WireMockServerSettingsParser
|
||||
{
|
||||
var proxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
AllowAutoRedirect = parser.GetBoolValue("AllowAutoRedirect"),
|
||||
ClientX509Certificate2ThumbprintOrSubjectName = parser.GetStringValue("ClientX509Certificate2ThumbprintOrSubjectName"),
|
||||
ExcludedCookies = parser.GetValues("ExcludedCookies"),
|
||||
ExcludedHeaders = parser.GetValues("ExcludedHeaders"),
|
||||
AllowAutoRedirect = parser.GetBoolValue(nameof(ProxyAndRecordSettings.AllowAutoRedirect)),
|
||||
ClientX509Certificate2ThumbprintOrSubjectName = parser.GetStringValue(nameof(ProxyAndRecordSettings.ClientX509Certificate2ThumbprintOrSubjectName)),
|
||||
ExcludedCookies = parser.GetValues(nameof(ProxyAndRecordSettings.ExcludedCookies)),
|
||||
ExcludedHeaders = parser.GetValues(nameof(ProxyAndRecordSettings.ExcludedHeaders)),
|
||||
// PreferProxyMapping = parser.GetBoolValue(nameof(ProxyAndRecordSettings.PreferProxyMapping)),
|
||||
SaveMapping = parser.GetBoolValue("SaveMapping"),
|
||||
SaveMappingForStatusCodePattern = parser.GetStringValue("SaveMappingForStatusCodePattern", "*"),
|
||||
SaveMappingToFile = parser.GetBoolValue("SaveMappingToFile"),
|
||||
SaveMapping = parser.GetBoolValue(nameof(ProxyAndRecordSettings.SaveMapping)),
|
||||
SaveMappingForStatusCodePattern = parser.GetStringValue(nameof(ProxyAndRecordSettings.SaveMappingForStatusCodePattern), "*"),
|
||||
SaveMappingToFile = parser.GetBoolValue(nameof(ProxyAndRecordSettings.SaveMappingToFile)),
|
||||
UseDefinedRequestMatchers = parser.GetBoolValue(nameof(ProxyAndRecordSettings.UseDefinedRequestMatchers)),
|
||||
AppendGuidToSavedMappingFile = parser.GetBoolValue(nameof(ProxyAndRecordSettings.AppendGuidToSavedMappingFile)),
|
||||
PrefixForSavedMappingFile = parser.GetStringValue(nameof(ProxyAndRecordSettings.PrefixForSavedMappingFile), ProxyAndRecordSettings.DefaultPrefixForSavedMappingFile),
|
||||
Url = proxyUrl!,
|
||||
SaveMappingSettings = new ProxySaveMappingSettings
|
||||
{
|
||||
StatusCodePattern = parser.GetStringValue("SaveMappingForStatusCodePattern", "*"),
|
||||
StatusCodePattern = parser.GetStringValue(nameof(ProxyAndRecordSettings.SaveMappingForStatusCodePattern), "*"),
|
||||
// HttpMethods = new ProxySaveMappingSetting<string[]>(parser.GetValues("DoNotSaveMappingForHttpMethods", new string[0]), MatchBehaviour.RejectOnMatch)
|
||||
}
|
||||
},
|
||||
ProxyAll = parser.GetBoolValue(nameof(ProxyAndRecordSettings.ProxyAll))
|
||||
};
|
||||
|
||||
ParseWebProxyAddressSettings(proxyAndRecordSettings, parser);
|
||||
@@ -186,7 +188,7 @@ public static class WireMockServerSettingsParser
|
||||
settings.ReplaceSettings = new ProxyUrlReplaceSettings
|
||||
{
|
||||
OldValue = proxyUrlReplaceOldValue!,
|
||||
NewValue = proxyUrlReplaceNewValue!
|
||||
NewValue = proxyUrlReplaceNewValue
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using HandlebarsDotNet.Helpers.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Stef.Validation;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
@@ -14,8 +13,6 @@ namespace WireMock.Transformers;
|
||||
|
||||
internal class Transformer : ITransformer
|
||||
{
|
||||
private static readonly Type[] SupportedTypes = { typeof(bool), typeof(long), typeof(int), typeof(double), typeof(Guid), typeof(DateTime), typeof(TimeSpan), typeof(Uri) };
|
||||
|
||||
private readonly JsonSerializer _jsonSerializer;
|
||||
private readonly ITransformerContextFactory _factory;
|
||||
|
||||
@@ -250,7 +247,7 @@ internal class Transformer : ITransformer
|
||||
return;
|
||||
}
|
||||
|
||||
var transformed = transformerContext.ParseAndEvaluate(stringValue, model);
|
||||
var transformed = transformerContext.ParseAndEvaluate(stringValue!, model);
|
||||
if (!Equals(stringValue, transformed))
|
||||
{
|
||||
ReplaceNodeValue(options, node, transformed);
|
||||
@@ -269,9 +266,10 @@ internal class Transformer : ITransformer
|
||||
return;
|
||||
|
||||
case string transformedString:
|
||||
if (TryConvert(transformedString, out var convertedFromStringValue))
|
||||
var (isConvertedFromString, convertedValueFromString) = TryConvert(options, transformedString);
|
||||
if (isConvertedFromString)
|
||||
{
|
||||
node.Replace(JToken.FromObject(convertedFromStringValue, _jsonSerializer));
|
||||
node.Replace(JToken.FromObject(convertedValueFromString, _jsonSerializer));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -293,7 +291,8 @@ internal class Transformer : ITransformer
|
||||
break;
|
||||
|
||||
case { }:
|
||||
if (TryConvert(transformedValue, out var convertedValue))
|
||||
var (isConverted, convertedValue) = TryConvert(options, transformedValue);
|
||||
if (isConverted)
|
||||
{
|
||||
node.Replace(JToken.FromObject(convertedValue, _jsonSerializer));
|
||||
}
|
||||
@@ -309,23 +308,28 @@ internal class Transformer : ITransformer
|
||||
return JsonUtils.TryParseAsJObject(stringValue, out var parsedAsjObject) ? parsedAsjObject : stringValue;
|
||||
}
|
||||
|
||||
private static bool TryConvert(object? transformedValue, [NotNullWhen(true)] out object? convertedValue)
|
||||
private static (bool IsConverted, object ConvertedValue) TryConvert(ReplaceNodeOptions options, object value)
|
||||
{
|
||||
foreach (var supportedType in SupportedTypes)
|
||||
var valueAsString = value as string;
|
||||
|
||||
if (options == ReplaceNodeOptions.Evaluate)
|
||||
{
|
||||
try
|
||||
if (valueAsString != null && WrappedString.TryDecode(valueAsString, out var decoded))
|
||||
{
|
||||
convertedValue = Convert.ChangeType(transformedValue, supportedType);
|
||||
return convertedValue is not null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore
|
||||
return (true, decoded);
|
||||
}
|
||||
|
||||
return (false, value);
|
||||
}
|
||||
|
||||
convertedValue = null;
|
||||
return false;
|
||||
if (valueAsString != null)
|
||||
{
|
||||
return WrappedString.TryDecode(valueAsString, out var decoded) ?
|
||||
(true, decoded) :
|
||||
StringUtils.TryConvertToKnownType(valueAsString);
|
||||
}
|
||||
|
||||
return (false, value);
|
||||
}
|
||||
|
||||
private static IBodyData TransformBodyAsString(ITransformerContext transformerContext, object model, IBodyData original)
|
||||
|
||||
@@ -8,6 +8,48 @@ namespace WireMock.Util;
|
||||
|
||||
internal static class StringUtils
|
||||
{
|
||||
private static readonly string[] ValidUriSchemes =
|
||||
{
|
||||
"ftp://",
|
||||
"http://",
|
||||
"https://"
|
||||
};
|
||||
|
||||
private static readonly Func<string, (bool IsConverted, object ConvertedValue)>[] ConversionsFunctions =
|
||||
{
|
||||
s => bool.TryParse(s, out var result) ? (true, result) : (false, s),
|
||||
s => int.TryParse(s, out var result) ? (true, result) : (false, s),
|
||||
s => long.TryParse(s, out var result) ? (true, result) : (false, s),
|
||||
s => double.TryParse(s, out var result) ? (true, result) : (false, s),
|
||||
s => Guid.TryParse(s, out var result) ? (true, result) : (false, s),
|
||||
s => TimeSpan.TryParse(s, out var result) ? (true, result) : (false, s),
|
||||
s => DateTime.TryParse(s, out var result) ? (true, result) : (false, s),
|
||||
s =>
|
||||
{
|
||||
if (ValidUriSchemes.Any(u => s.StartsWith(u, StringComparison.OrdinalIgnoreCase)) &&
|
||||
Uri.TryCreate(s, UriKind.RelativeOrAbsolute, out var uri))
|
||||
{
|
||||
return (true, uri);
|
||||
}
|
||||
|
||||
return (false, s);
|
||||
}
|
||||
};
|
||||
|
||||
public static (bool IsConverted, object ConvertedValue) TryConvertToKnownType(string value)
|
||||
{
|
||||
foreach (var func in ConversionsFunctions)
|
||||
{
|
||||
var result = func(value);
|
||||
if (result.IsConverted)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return (false, value);
|
||||
}
|
||||
|
||||
public static MatchOperator ParseMatchOperator(string? value)
|
||||
{
|
||||
return value != null && Enum.TryParse<MatchOperator>(value, out var matchOperator)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Nelibur.ObjectMapper;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Admin.Settings;
|
||||
using WireMock.Settings;
|
||||
|
||||
@@ -12,10 +13,12 @@ internal sealed class TinyMapperUtils
|
||||
{
|
||||
TinyMapper.Bind<ProxyAndRecordSettings, ProxyAndRecordSettingsModel>();
|
||||
TinyMapper.Bind<WebProxySettings, WebProxySettingsModel>();
|
||||
TinyMapper.Bind<WebProxySettings, WebProxyModel>();
|
||||
TinyMapper.Bind<ProxyUrlReplaceSettings, ProxyUrlReplaceSettingsModel>();
|
||||
|
||||
TinyMapper.Bind<ProxyAndRecordSettingsModel, ProxyAndRecordSettings>();
|
||||
TinyMapper.Bind<WebProxySettingsModel, WebProxySettings>();
|
||||
TinyMapper.Bind<WebProxyModel, WebProxySettings>();
|
||||
TinyMapper.Bind<ProxyUrlReplaceSettingsModel, ProxyUrlReplaceSettings>();
|
||||
}
|
||||
|
||||
@@ -28,4 +31,24 @@ internal sealed class TinyMapperUtils
|
||||
{
|
||||
return model == null ? null : TinyMapper.Map<ProxyAndRecordSettings>(model);
|
||||
}
|
||||
|
||||
public ProxyUrlReplaceSettingsModel? Map(ProxyUrlReplaceSettings? instance)
|
||||
{
|
||||
return instance == null ? null : TinyMapper.Map<ProxyUrlReplaceSettingsModel>(instance);
|
||||
}
|
||||
|
||||
public ProxyUrlReplaceSettings? Map(ProxyUrlReplaceSettingsModel? model)
|
||||
{
|
||||
return model == null ? null : TinyMapper.Map<ProxyUrlReplaceSettings>(model);
|
||||
}
|
||||
|
||||
public WebProxyModel? Map(WebProxySettings? instance)
|
||||
{
|
||||
return instance == null ? null : TinyMapper.Map<WebProxyModel>(instance);
|
||||
}
|
||||
|
||||
public WebProxySettings? Map(WebProxyModel? model)
|
||||
{
|
||||
return model == null ? null : TinyMapper.Map<WebProxySettings>(model);
|
||||
}
|
||||
}
|
||||
@@ -72,16 +72,9 @@
|
||||
<PackageReference Include="TinyMapper" Version="3.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Configuration)' == 'Debug - Sonar'">
|
||||
<PackageReference Include="SonarAnalyzer.CSharp" Version="7.8.0.7320">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard1.3' ">
|
||||
<PackageReference Include="XPath2.Extensions" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.12.2" />
|
||||
<PackageReference Include="XPath2.Extensions" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.34.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' or '$(TargetFramework)' == 'net452' ">
|
||||
@@ -189,13 +182,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.0" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.1.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.1.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.1.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.1.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.1.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.1.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace WireMock.Org.Abstractions
|
||||
{
|
||||
public class GetAdminMappingsResult
|
||||
{
|
||||
public Mappings Mappings { get; set; }
|
||||
namespace WireMock.Org.Abstractions;
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
public class GetAdminMappingsResult
|
||||
{
|
||||
public Mapping[] Mappings { get; set; }
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
58
src/WireMock.Org.Abstractions/Mapping.cs
Normal file
58
src/WireMock.Org.Abstractions/Mapping.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
namespace WireMock.Org.Abstractions;
|
||||
|
||||
public class Mapping
|
||||
{
|
||||
/// <summary>
|
||||
/// This stub mapping's unique identifier
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias for the id
|
||||
/// </summary>
|
||||
public string Uuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The stub mapping's name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
public MappingsRequest Request { get; set; }
|
||||
|
||||
public MappingsResponse Response { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.
|
||||
/// </summary>
|
||||
public bool Persistent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This stub mapping's priority relative to others. 1 is highest.
|
||||
/// </summary>
|
||||
public int Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the scenario that this stub mapping is part of
|
||||
/// </summary>
|
||||
public string ScenarioName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The required state of the scenario in order for this stub to be matched.
|
||||
/// </summary>
|
||||
public string RequiredScenarioState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The new state for the scenario to be updated to after this stub is served.
|
||||
/// </summary>
|
||||
public string NewScenarioState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A map of the names of post serve action extensions to trigger and their parameters.
|
||||
/// </summary>
|
||||
public object PostServeActions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs.
|
||||
/// </summary>
|
||||
public object Metadata { get; set; }
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
namespace WireMock.Org.Abstractions
|
||||
{
|
||||
public class Mappings
|
||||
{
|
||||
/// <summary>
|
||||
/// This stub mapping's unique identifier
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias for the id
|
||||
/// </summary>
|
||||
public string Uuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The stub mapping's name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
public MappingsRequest Request { get; set; }
|
||||
|
||||
public MappingsResponse Response { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.
|
||||
/// </summary>
|
||||
public bool Persistent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This stub mapping's priority relative to others. 1 is highest.
|
||||
/// </summary>
|
||||
public int Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the scenario that this stub mapping is part of
|
||||
/// </summary>
|
||||
public string ScenarioName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The required state of the scenario in order for this stub to be matched.
|
||||
/// </summary>
|
||||
public string RequiredScenarioState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The new state for the scenario to be updated to after this stub is served.
|
||||
/// </summary>
|
||||
public string NewScenarioState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A map of the names of post serve action extensions to trigger and their parameters.
|
||||
/// </summary>
|
||||
public object PostServeActions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs.
|
||||
/// </summary>
|
||||
public object Metadata { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace WireMock.Org.Abstractions
|
||||
{
|
||||
public class PostAdminMappingsFindByMetadataResult
|
||||
{
|
||||
public Mappings Mappings { get; set; }
|
||||
namespace WireMock.Org.Abstractions;
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
public class PostAdminMappingsFindByMetadataResult
|
||||
{
|
||||
public Mapping[] Mappings { get; set; }
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace WireMock.Org.Abstractions
|
||||
{
|
||||
public class PostAdminRecordingsSnapshotResult
|
||||
{
|
||||
public Mappings Mappings { get; set; }
|
||||
namespace WireMock.Org.Abstractions;
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
public class PostAdminRecordingsSnapshotResult
|
||||
{
|
||||
public Mapping[] Mappings { get; set; }
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace WireMock.Org.Abstractions
|
||||
{
|
||||
public class PostAdminRecordingsStopResult
|
||||
{
|
||||
public Mappings Mappings { get; set; }
|
||||
namespace WireMock.Org.Abstractions;
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
public class PostAdminRecordingsStopResult
|
||||
{
|
||||
public Mapping[] Mappings { get; set; }
|
||||
|
||||
public Meta Meta { get; set; }
|
||||
}
|
||||
@@ -1,299 +1,293 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using AnyOfTypes;
|
||||
using RestEase;
|
||||
using WireMock.Org.Abstractions;
|
||||
|
||||
namespace WireMock.Org.RestClient
|
||||
namespace WireMock.Org.RestClient;
|
||||
|
||||
/// <summary>
|
||||
/// Summary: WireMockOrg
|
||||
///
|
||||
/// Title : WireMock
|
||||
/// Version: 2.3x
|
||||
/// </summary>
|
||||
public interface IWireMockOrgApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary: WireMockOrg
|
||||
/// Get all stub mappings
|
||||
///
|
||||
/// Title : WireMock
|
||||
/// Version: 2.33.2
|
||||
/// GetAdminMappings (/__admin/mappings)
|
||||
/// </summary>
|
||||
public interface IWireMockOrgApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all stub mappings
|
||||
///
|
||||
/// GetAdminMappings (/__admin/mappings)
|
||||
/// </summary>
|
||||
/// <param name="limit">The maximum number of results to return</param>
|
||||
/// <param name="offset">The start index of the results to return</param>
|
||||
[Get("/__admin/mappings")]
|
||||
Task<GetAdminMappingsResult> GetAdminMappingsAsync([Query] int? limit, [Query] int? offset);
|
||||
/// <param name="limit">The maximum number of results to return</param>
|
||||
/// <param name="offset">The start index of the results to return</param>
|
||||
[Get("/__admin/mappings")]
|
||||
Task<GetAdminMappingsResult> GetAdminMappingsAsync([Query] int? limit, [Query] int? offset);
|
||||
|
||||
/// <summary>
|
||||
/// Create a new stub mapping
|
||||
///
|
||||
/// PostAdminMappings (/__admin/mappings)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminMappingsResult> PostAdminMappingsAsync();
|
||||
/// <summary>
|
||||
/// Create a new stub mapping
|
||||
///
|
||||
/// PostAdminMappings (/__admin/mappings)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminMappingsResult> PostAdminMappingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Delete all stub mappings
|
||||
///
|
||||
/// DeleteAdminMappings (/__admin/mappings)
|
||||
/// </summary>
|
||||
[Delete("/__admin/mappings")]
|
||||
Task<object> DeleteAdminMappingsAsync();
|
||||
/// <summary>
|
||||
/// Delete all stub mappings
|
||||
///
|
||||
/// DeleteAdminMappings (/__admin/mappings)
|
||||
/// </summary>
|
||||
[Delete("/__admin/mappings")]
|
||||
Task<object> DeleteAdminMappingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Reset stub mappings
|
||||
///
|
||||
/// PostAdminMappingsReset (/__admin/mappings/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/reset")]
|
||||
Task<object> PostAdminMappingsResetAsync();
|
||||
/// <summary>
|
||||
/// Reset stub mappings
|
||||
///
|
||||
/// PostAdminMappingsReset (/__admin/mappings/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/reset")]
|
||||
Task<object> PostAdminMappingsResetAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Persist stub mappings
|
||||
///
|
||||
/// PostAdminMappingsSave (/__admin/mappings/save)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/save")]
|
||||
Task<object> PostAdminMappingsSaveAsync();
|
||||
/// <summary>
|
||||
/// Persist stub mappings
|
||||
///
|
||||
/// PostAdminMappingsSave (/__admin/mappings/save)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/save")]
|
||||
Task<object> PostAdminMappingsSaveAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get stub mapping by ID
|
||||
///
|
||||
/// GetAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
|
||||
/// </summary>
|
||||
/// <param name="stubMappingId">The UUID of stub mapping</param>
|
||||
[Get("/__admin/mappings/{stubMappingId}")]
|
||||
Task<Response<AnyOf<GetAdminMappingsByStubMappingIdResult, object>>> GetAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
|
||||
/// <summary>
|
||||
/// Get stub mapping by ID
|
||||
///
|
||||
/// GetAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
|
||||
/// </summary>
|
||||
/// <param name="stubMappingId">The UUID of stub mapping</param>
|
||||
[Get("/__admin/mappings/{stubMappingId}")]
|
||||
Task<Response<AnyOf<GetAdminMappingsByStubMappingIdResult, object>>> GetAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
|
||||
|
||||
/// <summary>
|
||||
/// Update a stub mapping
|
||||
///
|
||||
/// PutAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
|
||||
/// </summary>
|
||||
/// <param name="stubMappingId">The UUID of stub mapping</param>
|
||||
[Put("/__admin/mappings/{stubMappingId}")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<Response<AnyOf<PutAdminMappingsByStubMappingIdResult, object>>> PutAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
|
||||
/// <summary>
|
||||
/// Update a stub mapping
|
||||
///
|
||||
/// PutAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
|
||||
/// </summary>
|
||||
/// <param name="stubMappingId">The UUID of stub mapping</param>
|
||||
[Put("/__admin/mappings/{stubMappingId}")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<Response<AnyOf<PutAdminMappingsByStubMappingIdResult, object>>> PutAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a stub mapping
|
||||
///
|
||||
/// DeleteAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
|
||||
/// </summary>
|
||||
/// <param name="stubMappingId">The UUID of stub mapping</param>
|
||||
[Delete("/__admin/mappings/{stubMappingId}")]
|
||||
Task<object> DeleteAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
|
||||
/// <summary>
|
||||
/// Delete a stub mapping
|
||||
///
|
||||
/// DeleteAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
|
||||
/// </summary>
|
||||
/// <param name="stubMappingId">The UUID of stub mapping</param>
|
||||
[Delete("/__admin/mappings/{stubMappingId}")]
|
||||
Task<object> DeleteAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
|
||||
|
||||
/// <summary>
|
||||
/// Find stubs by matching on their metadata
|
||||
///
|
||||
/// PostAdminMappingsFindByMetadata (/__admin/mappings/find-by-metadata)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/find-by-metadata")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminMappingsFindByMetadataResult> PostAdminMappingsFindByMetadataAsync();
|
||||
/// <summary>
|
||||
/// Find stubs by matching on their metadata
|
||||
///
|
||||
/// PostAdminMappingsFindByMetadata (/__admin/mappings/find-by-metadata)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/find-by-metadata")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminMappingsFindByMetadataResult> PostAdminMappingsFindByMetadataAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Delete stub mappings matching metadata
|
||||
///
|
||||
/// PostAdminMappingsRemoveByMetadata (/__admin/mappings/remove-by-metadata)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/remove-by-metadata")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminMappingsRemoveByMetadataAsync();
|
||||
/// <summary>
|
||||
/// Delete stub mappings matching metadata
|
||||
///
|
||||
/// PostAdminMappingsRemoveByMetadata (/__admin/mappings/remove-by-metadata)
|
||||
/// </summary>
|
||||
[Post("/__admin/mappings/remove-by-metadata")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminMappingsRemoveByMetadataAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get all requests in journal
|
||||
///
|
||||
/// GetAdminRequests (/__admin/requests)
|
||||
/// </summary>
|
||||
/// <param name="limit">The maximum number of results to return</param>
|
||||
/// <param name="since">Only return logged requests after this date</param>
|
||||
[Get("/__admin/requests")]
|
||||
Task<object> GetAdminRequestsAsync([Query] string limit, [Query] string since);
|
||||
/// <summary>
|
||||
/// Get all requests in journal
|
||||
///
|
||||
/// GetAdminRequests (/__admin/requests)
|
||||
/// </summary>
|
||||
/// <param name="limit">The maximum number of results to return</param>
|
||||
/// <param name="since">Only return logged requests after this date</param>
|
||||
[Get("/__admin/requests")]
|
||||
Task<object> GetAdminRequestsAsync([Query] string limit, [Query] string since);
|
||||
|
||||
/// <summary>
|
||||
/// Delete all requests in journal
|
||||
///
|
||||
/// DeleteAdminRequests (/__admin/requests)
|
||||
/// </summary>
|
||||
[Delete("/__admin/requests")]
|
||||
Task<object> DeleteAdminRequestsAsync();
|
||||
/// <summary>
|
||||
/// Delete all requests in journal
|
||||
///
|
||||
/// DeleteAdminRequests (/__admin/requests)
|
||||
/// </summary>
|
||||
[Delete("/__admin/requests")]
|
||||
Task<object> DeleteAdminRequestsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get request by ID
|
||||
///
|
||||
/// GetAdminRequestsByRequestId (/__admin/requests/{requestId})
|
||||
/// </summary>
|
||||
/// <param name="requestId">The UUID of the logged request</param>
|
||||
[Get("/__admin/requests/{requestId}")]
|
||||
Task<object> GetAdminRequestsByRequestIdAsync([Path] string requestId);
|
||||
/// <summary>
|
||||
/// Get request by ID
|
||||
///
|
||||
/// GetAdminRequestsByRequestId (/__admin/requests/{requestId})
|
||||
/// </summary>
|
||||
/// <param name="requestId">The UUID of the logged request</param>
|
||||
[Get("/__admin/requests/{requestId}")]
|
||||
Task<object> GetAdminRequestsByRequestIdAsync([Path] string requestId);
|
||||
|
||||
/// <summary>
|
||||
/// Delete request by ID
|
||||
///
|
||||
/// DeleteAdminRequestsByRequestId (/__admin/requests/{requestId})
|
||||
/// </summary>
|
||||
/// <param name="requestId">The UUID of the logged request</param>
|
||||
[Delete("/__admin/requests/{requestId}")]
|
||||
Task<object> DeleteAdminRequestsByRequestIdAsync([Path] string requestId);
|
||||
/// <summary>
|
||||
/// Delete request by ID
|
||||
///
|
||||
/// DeleteAdminRequestsByRequestId (/__admin/requests/{requestId})
|
||||
/// </summary>
|
||||
/// <param name="requestId">The UUID of the logged request</param>
|
||||
[Delete("/__admin/requests/{requestId}")]
|
||||
Task<object> DeleteAdminRequestsByRequestIdAsync([Path] string requestId);
|
||||
|
||||
/// <summary>
|
||||
/// Empty the request journal
|
||||
///
|
||||
/// PostAdminRequestsReset (/__admin/requests/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/reset")]
|
||||
Task<object> PostAdminRequestsResetAsync();
|
||||
/// <summary>
|
||||
/// Empty the request journal
|
||||
///
|
||||
/// PostAdminRequestsReset (/__admin/requests/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/reset")]
|
||||
Task<object> PostAdminRequestsResetAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Count requests by criteria
|
||||
///
|
||||
/// PostAdminRequestsCount (/__admin/requests/count)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/count")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminRequestsCountResult> PostAdminRequestsCountAsync();
|
||||
/// <summary>
|
||||
/// Count requests by criteria
|
||||
///
|
||||
/// PostAdminRequestsCount (/__admin/requests/count)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/count")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminRequestsCountResult> PostAdminRequestsCountAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Remove requests by criteria
|
||||
///
|
||||
/// PostAdminRequestsRemove (/__admin/requests/remove)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/remove")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRequestsRemoveAsync();
|
||||
/// <summary>
|
||||
/// Remove requests by criteria
|
||||
///
|
||||
/// PostAdminRequestsRemove (/__admin/requests/remove)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/remove")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRequestsRemoveAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Delete requests mappings matching metadata
|
||||
///
|
||||
/// PostAdminRequestsRemoveByMetadata (/__admin/requests/remove-by-metadata)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/remove-by-metadata")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRequestsRemoveByMetadataAsync();
|
||||
/// <summary>
|
||||
/// Delete requests mappings matching metadata
|
||||
///
|
||||
/// PostAdminRequestsRemoveByMetadata (/__admin/requests/remove-by-metadata)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/remove-by-metadata")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRequestsRemoveByMetadataAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Find requests by criteria
|
||||
///
|
||||
/// PostAdminRequestsFind (/__admin/requests/find)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/find")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRequestsFindAsync();
|
||||
/// <summary>
|
||||
/// Find requests by criteria
|
||||
///
|
||||
/// PostAdminRequestsFind (/__admin/requests/find)
|
||||
/// </summary>
|
||||
[Post("/__admin/requests/find")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRequestsFindAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Find unmatched requests
|
||||
///
|
||||
/// GetAdminRequestsUnmatched (/__admin/requests/unmatched)
|
||||
/// </summary>
|
||||
[Get("/__admin/requests/unmatched")]
|
||||
Task<object> GetAdminRequestsUnmatchedAsync();
|
||||
/// <summary>
|
||||
/// Find unmatched requests
|
||||
///
|
||||
/// GetAdminRequestsUnmatched (/__admin/requests/unmatched)
|
||||
/// </summary>
|
||||
[Get("/__admin/requests/unmatched")]
|
||||
Task<object> GetAdminRequestsUnmatchedAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve near-misses for all unmatched requests
|
||||
///
|
||||
/// GetAdminRequestsUnmatchedNearMisses (/__admin/requests/unmatched/near-misses)
|
||||
/// </summary>
|
||||
[Get("/__admin/requests/unmatched/near-misses")]
|
||||
Task<GetAdminRequestsUnmatchedNearMissesResult> GetAdminRequestsUnmatchedNearMissesAsync();
|
||||
/// <summary>
|
||||
/// Retrieve near-misses for all unmatched requests
|
||||
///
|
||||
/// GetAdminRequestsUnmatchedNearMisses (/__admin/requests/unmatched/near-misses)
|
||||
/// </summary>
|
||||
[Get("/__admin/requests/unmatched/near-misses")]
|
||||
Task<GetAdminRequestsUnmatchedNearMissesResult> GetAdminRequestsUnmatchedNearMissesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Find near misses matching specific request
|
||||
///
|
||||
/// PostAdminNearMissesRequest (/__admin/near-misses/request)
|
||||
/// </summary>
|
||||
[Post("/__admin/near-misses/request")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminNearMissesRequestResult> PostAdminNearMissesRequestAsync();
|
||||
/// <summary>
|
||||
/// Find near misses matching specific request
|
||||
///
|
||||
/// PostAdminNearMissesRequest (/__admin/near-misses/request)
|
||||
/// </summary>
|
||||
[Post("/__admin/near-misses/request")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminNearMissesRequestResult> PostAdminNearMissesRequestAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Find near misses matching request pattern
|
||||
///
|
||||
/// PostAdminNearMissesRequestPattern (/__admin/near-misses/request-pattern)
|
||||
/// </summary>
|
||||
[Post("/__admin/near-misses/request-pattern")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminNearMissesRequestPatternResult> PostAdminNearMissesRequestPatternAsync();
|
||||
/// <summary>
|
||||
/// Find near misses matching request pattern
|
||||
///
|
||||
/// PostAdminNearMissesRequestPattern (/__admin/near-misses/request-pattern)
|
||||
/// </summary>
|
||||
[Post("/__admin/near-misses/request-pattern")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminNearMissesRequestPatternResult> PostAdminNearMissesRequestPatternAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Start recording
|
||||
///
|
||||
/// PostAdminRecordingsStart (/__admin/recordings/start)
|
||||
/// </summary>
|
||||
[Post("/__admin/recordings/start")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRecordingsStartAsync();
|
||||
/// <summary>
|
||||
/// Start recording
|
||||
///
|
||||
/// PostAdminRecordingsStart (/__admin/recordings/start)
|
||||
/// </summary>
|
||||
[Post("/__admin/recordings/start")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminRecordingsStartAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Stop recording
|
||||
///
|
||||
/// PostAdminRecordingsStop (/__admin/recordings/stop)
|
||||
/// </summary>
|
||||
[Post("/__admin/recordings/stop")]
|
||||
Task<PostAdminRecordingsStopResult> PostAdminRecordingsStopAsync();
|
||||
/// <summary>
|
||||
/// Stop recording
|
||||
///
|
||||
/// PostAdminRecordingsStop (/__admin/recordings/stop)
|
||||
/// </summary>
|
||||
[Post("/__admin/recordings/stop")]
|
||||
Task<PostAdminRecordingsStopResult> PostAdminRecordingsStopAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get recording status
|
||||
///
|
||||
/// GetAdminRecordingsStatus (/__admin/recordings/status)
|
||||
/// </summary>
|
||||
[Get("/__admin/recordings/status")]
|
||||
Task<GetAdminRecordingsStatusResult> GetAdminRecordingsStatusAsync();
|
||||
/// <summary>
|
||||
/// Get recording status
|
||||
///
|
||||
/// GetAdminRecordingsStatus (/__admin/recordings/status)
|
||||
/// </summary>
|
||||
[Get("/__admin/recordings/status")]
|
||||
Task<GetAdminRecordingsStatusResult> GetAdminRecordingsStatusAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Take a snapshot recording
|
||||
///
|
||||
/// PostAdminRecordingsSnapshot (/__admin/recordings/snapshot)
|
||||
/// </summary>
|
||||
[Post("/__admin/recordings/snapshot")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminRecordingsSnapshotResult> PostAdminRecordingsSnapshotAsync();
|
||||
/// <summary>
|
||||
/// Take a snapshot recording
|
||||
///
|
||||
/// PostAdminRecordingsSnapshot (/__admin/recordings/snapshot)
|
||||
/// </summary>
|
||||
[Post("/__admin/recordings/snapshot")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<PostAdminRecordingsSnapshotResult> PostAdminRecordingsSnapshotAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get all scenarios
|
||||
///
|
||||
/// GetAdminScenarios (/__admin/scenarios)
|
||||
/// </summary>
|
||||
[Get("/__admin/scenarios")]
|
||||
Task<GetAdminScenariosResult> GetAdminScenariosAsync();
|
||||
/// <summary>
|
||||
/// Get all scenarios
|
||||
///
|
||||
/// GetAdminScenarios (/__admin/scenarios)
|
||||
/// </summary>
|
||||
[Get("/__admin/scenarios")]
|
||||
Task<GetAdminScenariosResult> GetAdminScenariosAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Reset the state of all scenarios
|
||||
///
|
||||
/// PostAdminScenariosReset (/__admin/scenarios/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/scenarios/reset")]
|
||||
Task<object> PostAdminScenariosResetAsync();
|
||||
/// <summary>
|
||||
/// Reset the state of all scenarios
|
||||
///
|
||||
/// PostAdminScenariosReset (/__admin/scenarios/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/scenarios/reset")]
|
||||
Task<object> PostAdminScenariosResetAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Update global settings
|
||||
///
|
||||
/// PostAdminSettings (/__admin/settings)
|
||||
/// </summary>
|
||||
[Post("/__admin/settings")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminSettingsAsync();
|
||||
/// <summary>
|
||||
/// Update global settings
|
||||
///
|
||||
/// PostAdminSettings (/__admin/settings)
|
||||
/// </summary>
|
||||
[Post("/__admin/settings")]
|
||||
[Header("Content-Type", "application/json")]
|
||||
Task<object> PostAdminSettingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Reset mappings and request journal
|
||||
///
|
||||
/// PostAdminReset (/__admin/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/reset")]
|
||||
Task<object> PostAdminResetAsync();
|
||||
/// <summary>
|
||||
/// Reset mappings and request journal
|
||||
///
|
||||
/// PostAdminReset (/__admin/reset)
|
||||
/// </summary>
|
||||
[Post("/__admin/reset")]
|
||||
Task<object> PostAdminResetAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Shutdown the WireMock server
|
||||
///
|
||||
/// PostAdminShutdown (/__admin/shutdown)
|
||||
/// </summary>
|
||||
[Post("/__admin/shutdown")]
|
||||
Task<object> PostAdminShutdownAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// Shutdown the WireMock server
|
||||
///
|
||||
/// PostAdminShutdown (/__admin/shutdown)
|
||||
/// </summary>
|
||||
[Post("/__admin/shutdown")]
|
||||
Task<object> PostAdminShutdownAsync();
|
||||
}
|
||||
@@ -130,6 +130,17 @@ public class WireMockAssertionsTests : IDisposable
|
||||
_httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer a");
|
||||
await _httpClient.GetAsync("").ConfigureAwait(false);
|
||||
|
||||
_server.Should()
|
||||
.HaveReceivedACall()
|
||||
.WitHeaderKey("Authorization");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HaveReceivedACall_WithHeader_WhenACallWasMadeWithExpectedHeaderWithValue_Should_BeOK()
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer a");
|
||||
await _httpClient.GetAsync("").ConfigureAwait(false);
|
||||
|
||||
_server.Should()
|
||||
.HaveReceivedACall()
|
||||
.WithHeader("Authorization", "Bearer a");
|
||||
@@ -163,7 +174,7 @@ public class WireMockAssertionsTests : IDisposable
|
||||
|
||||
act.Should().Throw<Exception>()
|
||||
.And.Message.Should()
|
||||
.Contain("to contain \"Authorization\".");
|
||||
.Contain("\"Authorization\"");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -240,8 +251,13 @@ public class WireMockAssertionsTests : IDisposable
|
||||
});
|
||||
|
||||
// Assert
|
||||
server.Should().HaveReceivedACall().WithHeader("Authorization", "Bearer invalidToken");
|
||||
server.Should().HaveReceivedACall().WithHeader("Authorization", "Bearer validToken");
|
||||
server.Should()
|
||||
.HaveReceivedACall()
|
||||
.WithHeader("Authorization", "Bearer invalidToken").And.WithoutHeader("x", "y").And.WithoutHeaderKey("a");
|
||||
|
||||
server.Should().
|
||||
HaveReceivedACall()
|
||||
.WithHeader("Authorization", "Bearer validToken").And.WithoutHeader("Authorization", "y");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Types;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.ResponseBuilders;
|
||||
|
||||
public class ResponseWithHandlebarsDateTimeTests
|
||||
{
|
||||
private const string ClientIp = "::1";
|
||||
private readonly WireMockServerSettings _settings = new();
|
||||
|
||||
private readonly Mock<IMapping> _mappingMock;
|
||||
|
||||
public ResponseWithHandlebarsDateTimeTests()
|
||||
{
|
||||
_mappingMock = new Mock<IMapping>();
|
||||
|
||||
var filesystemHandlerMock = new Mock<IFileSystemHandler>(MockBehavior.Strict);
|
||||
filesystemHandlerMock.Setup(fs => fs.ReadResponseBodyAsString(It.IsAny<string>())).Returns("abc");
|
||||
|
||||
_settings.FileSystemHandler = filesystemHandlerMock.Object;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ReplaceNodeOptions.EvaluateAndTryToConvert, JTokenType.Integer)]
|
||||
[InlineData(ReplaceNodeOptions.Evaluate, JTokenType.String)]
|
||||
public async Task Response_WithBodyAsJson_ProvideResponseAsync_Handlebars_DateTimeYear(ReplaceNodeOptions options, JTokenType expected)
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost"), "GET", ClientIp);
|
||||
|
||||
var responseBuilder = Response.Create()
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
DateTimeYear = "{{ DateTime.UtcNow \"yyyy\" }}"
|
||||
})
|
||||
.WithTransformer(options);
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
var jObject = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||
jObject["DateTimeYear"]!.Type.Should().Be(expected);
|
||||
jObject["DateTimeYear"]!.Value<string>().Should().Be(DateTime.Now.Year.ToString());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ReplaceNodeOptions.EvaluateAndTryToConvert, JTokenType.Date)]
|
||||
[InlineData(ReplaceNodeOptions.Evaluate, JTokenType.String)]
|
||||
public async Task Response_WithBodyAsJson_ProvideResponseAsync_Handlebars_DateTime(ReplaceNodeOptions options, JTokenType expected)
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost"), "GET", ClientIp);
|
||||
|
||||
var responseBuilder = Response.Create()
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
DateTime = "{{ DateTime.UtcNow }}"
|
||||
})
|
||||
.WithTransformer(options);
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
var jObject = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||
jObject["DateTime"]!.Type.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ReplaceNodeOptions.EvaluateAndTryToConvert, JTokenType.Integer)]
|
||||
[InlineData(ReplaceNodeOptions.Evaluate, JTokenType.String)]
|
||||
public async Task Response_WithBodyAsJson_ProvideResponseAsync_Handlebars_DateTimeWithStringFormat(ReplaceNodeOptions options, JTokenType expected)
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost"), "GET", ClientIp);
|
||||
|
||||
var responseBuilder = Response.Create()
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
StringFormatDateTime = "{{ String.Format (DateTime.UtcNow) \"yyMMddhhmmss\" }}"
|
||||
})
|
||||
.WithTransformer(options);
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
var jObject = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||
jObject["StringFormatDateTime"]!.Type.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Response_WithBody_ProvideResponseAsync_Handlebars_DateTime()
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost"), "GET", ClientIp);
|
||||
|
||||
var responseBuilder = Response.Create()
|
||||
.WithBody("{\nDateTimeYear = \"{{ DateTime.UtcNow \"yyyy\" }}\"")
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
response.Message.BodyData!.BodyAsString.Should().Contain($"DateTimeYear = \"{DateTime.Now.Year}\"");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ReplaceNodeOptions.EvaluateAndTryToConvert)]
|
||||
[InlineData(ReplaceNodeOptions.Evaluate)]
|
||||
public async Task Response_WithBodyAsJson_ProvideResponseAsync_Handlebars_WithStringFormatAsString(ReplaceNodeOptions options)
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost"), "GET", ClientIp);
|
||||
|
||||
var responseBuilder = Response.Create()
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
FormatAsString1 = "{{ String.FormatAsString (DateTime.UtcNow) \"yyMMddhhmmss\" }}",
|
||||
FormatAsString2 = "{{ String.FormatAsString (DateTime.UtcNow) }}",
|
||||
FormatAsString3 = "{{ String.FormatAsString 42 \"X\" }}",
|
||||
FormatAsString4 = "{{ String.FormatAsString 42 }}"
|
||||
})
|
||||
.WithTransformer(options);
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
var jObject = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||
jObject["FormatAsString1"]!.Type.Should().Be(JTokenType.String);
|
||||
jObject["FormatAsString2"]!.Type.Should().Be(JTokenType.String);
|
||||
|
||||
var formatAsString3 = jObject["FormatAsString3"]!;
|
||||
formatAsString3.Type.Should().Be(JTokenType.String);
|
||||
formatAsString3.Value<string>().Should().Be("2A");
|
||||
|
||||
var formatAsString4 = jObject["FormatAsString4"]!;
|
||||
formatAsString4.Type.Should().Be(JTokenType.String);
|
||||
formatAsString4.Value<string>().Should().Be("42");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
@@ -77,10 +78,8 @@ public class ResponseWithHandlebarsRandomTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ReplaceNodeOptions.Evaluate, JTokenType.Integer)]
|
||||
//[InlineData(ReplaceNodeOptions.Bool, JTokenType.String)]
|
||||
//[InlineData(ReplaceNodeOptions.Integer, JTokenType.Integer)]
|
||||
//[InlineData(ReplaceNodeOptions.Bool | ReplaceNodeOptions.Integer, JTokenType.Integer)]
|
||||
[InlineData(ReplaceNodeOptions.EvaluateAndTryToConvert, JTokenType.Integer)]
|
||||
[InlineData(ReplaceNodeOptions.Evaluate, JTokenType.String)]
|
||||
public async Task Response_ProvideResponseAsync_Handlebars_Random1_Integer(ReplaceNodeOptions options, JTokenType expected)
|
||||
{
|
||||
// Assign
|
||||
@@ -97,12 +96,14 @@ public class ResponseWithHandlebarsRandomTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["Value"].Type).IsEqualTo(expected);
|
||||
var jObject = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||
jObject["Value"]!.Type.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Response_ProvideResponseAsync_Handlebars_Random1_Guid()
|
||||
[Theory]
|
||||
[InlineData(ReplaceNodeOptions.EvaluateAndTryToConvert, JTokenType.Guid)]
|
||||
[InlineData(ReplaceNodeOptions.Evaluate, JTokenType.String)]
|
||||
public async Task Response_ProvideResponseAsync_Handlebars_Random1_Guid(ReplaceNodeOptions options, JTokenType expected)
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost:1234"), "GET", ClientIp);
|
||||
@@ -113,17 +114,15 @@ public class ResponseWithHandlebarsRandomTests
|
||||
Guid1 = "{{Random Type=\"Guid\" Uppercase=false}}",
|
||||
Guid2 = "{{Random Type=\"Guid\"}}"
|
||||
})
|
||||
.WithTransformer();
|
||||
.WithTransformer(options);
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
string guid1 = j["Guid1"].Value<string>();
|
||||
Check.That(guid1.ToUpper()).IsNotEqualTo(guid1);
|
||||
string guid2 = j["Guid2"].Value<string>();
|
||||
Check.That(guid2.ToUpper()).IsEqualTo(guid2);
|
||||
var jObject = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||
jObject["Guid1"]!.Type.Should().Be(expected);
|
||||
jObject["Guid2"]!.Type.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -149,7 +148,7 @@ public class ResponseWithHandlebarsRandomTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Response_ProvideResponseAsync_Handlebars_Random2()
|
||||
public async Task Response_ProvideResponseAsync_Handlebars_Random_Integer()
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost:1234"), "GET", ClientIp);
|
||||
@@ -168,4 +167,25 @@ public class ResponseWithHandlebarsRandomTests
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["Integer"].Value<int>()).IsStrictlyGreaterThan(10000000).And.IsStrictlyLessThan(99999999);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Response_ProvideResponseAsync_Handlebars_Random_Long()
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost:1234"), "GET", ClientIp);
|
||||
|
||||
var responseBuilder = Response.Create()
|
||||
.WithBodyAsJson(new
|
||||
{
|
||||
Long = "{{#Random Type=\"Long\" Min=1000000000 Max=9999999999}}{{this}}{{/Random}}",
|
||||
})
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
var j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
j["Long"].Value<long>().Should().BeInRange(1000000000, 9999999999);
|
||||
}
|
||||
}
|
||||
@@ -500,34 +500,6 @@ public class ResponseWithTransformerTests
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("[{\"x\":\"test\"}]");
|
||||
}
|
||||
|
||||
//[Theory]
|
||||
//[InlineData(TransformerType.Handlebars, "a")]
|
||||
//[InlineData(TransformerType.Handlebars, "42")]
|
||||
//[InlineData(TransformerType.Handlebars, "{")]
|
||||
//[InlineData(TransformerType.Handlebars, "]")]
|
||||
//[InlineData(TransformerType.Handlebars, " ")]
|
||||
//public async Task Response_ProvideResponse_Transformer_WithBodyAsJsonWithExtraQuotes_AndSpecialOption_MakesAString_ResultAsObject(TransformerType transformerType, string text)
|
||||
//{
|
||||
// string jsonString = $"{{ \"x\": \"{text}\" }}";
|
||||
// var bodyData = new BodyData
|
||||
// {
|
||||
// BodyAsJson = JsonConvert.DeserializeObject(jsonString),
|
||||
// DetectedBodyType = BodyType.Json,
|
||||
// Encoding = Encoding.UTF8
|
||||
// };
|
||||
// var request = new RequestMessage(new UrlDetails("http://localhost/foo_object"), "POST", ClientIp, bodyData);
|
||||
|
||||
// var responseBuilder = Response.Create()
|
||||
// .WithBodyAsJson(new { text = "\"{{request.bodyAsJson.x}}\"" })
|
||||
// .WithTransformer(transformerType, false, ReplaceNodeOptions.Default);
|
||||
|
||||
// // Act
|
||||
// var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
|
||||
|
||||
// // Assert
|
||||
// JsonConvert.SerializeObject(response.Message.BodyData.BodyAsJson).Should().Be($"{{\"text\":\"{text}\"}}");
|
||||
//}
|
||||
|
||||
[Theory]
|
||||
[InlineData(TransformerType.Handlebars, "\"\"", "\"\"")]
|
||||
[InlineData(TransformerType.Handlebars, "\"a\"", "\"a\"")]
|
||||
@@ -543,7 +515,7 @@ public class ResponseWithTransformerTests
|
||||
[InlineData(TransformerType.Handlebars, "2147483647", "2147483647")]
|
||||
[InlineData(TransformerType.Handlebars, "\"9223372036854775807\"", "\"9223372036854775807\"")]
|
||||
[InlineData(TransformerType.Handlebars, "9223372036854775807", "9223372036854775807")]
|
||||
public async Task Response_ProvideResponse_Transformer_WithBodyAsJson_And_ReplaceNodeOptionsKeep(TransformerType transformerType, string value, string expected)
|
||||
public async Task Response_ProvideResponse_Transformer_WithBodyAsJson_And_ReplaceNodeOptionsEvaluate(TransformerType transformerType, string value, string expected)
|
||||
{
|
||||
string jsonString = $"{{ \"x\": {value} }}";
|
||||
var bodyData = new BodyData
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
},
|
||||
UseTransformer: true,
|
||||
TransformerType: Handlebars,
|
||||
TransformerReplaceNodeOptions: Evaluate
|
||||
TransformerReplaceNodeOptions: EvaluateAndTryToConvert
|
||||
},
|
||||
UseWebhooksFireAndForget: false
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using Moq;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization;
|
||||
|
||||
public class MappingFileNameSanitizerTests
|
||||
{
|
||||
private const string MappingGuid = "ce216a13-e7d6-42d7-91ac-8ae709e2add1";
|
||||
private const string MappingTitle = "Proxy Mapping for POST _ordermanagement_v1_orders_cancel";
|
||||
|
||||
[Fact]
|
||||
public void BuildSanitizedFileName_WithTitleAndGuid_AppendsGuid()
|
||||
{
|
||||
// Arrange
|
||||
var mappingMock = new Mock<IMapping>();
|
||||
mappingMock.Setup(m => m.Title).Returns(MappingTitle);
|
||||
mappingMock.Setup(m => m.Guid).Returns(new Guid(MappingGuid));
|
||||
|
||||
var settings = new WireMockServerSettings
|
||||
{
|
||||
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
AppendGuidToSavedMappingFile = true
|
||||
}
|
||||
};
|
||||
|
||||
var sanitizer = new MappingFileNameSanitizer(settings);
|
||||
|
||||
// Act
|
||||
var result = sanitizer.BuildSanitizedFileName(mappingMock.Object);
|
||||
|
||||
// Assert
|
||||
Assert.Equal($"Proxy Mapping for _POST_ordermanagement_v1_orders_cancel_{MappingGuid}.json", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSanitizedFileName_WithoutTitle_UsesGuid()
|
||||
{
|
||||
// Arrange
|
||||
var mappingMock = new Mock<IMapping>();
|
||||
mappingMock.Setup(m => m.Title).Returns((string?)null);
|
||||
mappingMock.Setup(m => m.Guid).Returns(new Guid(MappingGuid));
|
||||
|
||||
var settings = new WireMockServerSettings
|
||||
{
|
||||
ProxyAndRecordSettings = new ()
|
||||
};
|
||||
var sanitizer = new MappingFileNameSanitizer(settings);
|
||||
|
||||
// Act
|
||||
var result = sanitizer.BuildSanitizedFileName(mappingMock.Object);
|
||||
|
||||
// Assert
|
||||
Assert.Equal($"Proxy Mapping for _{MappingGuid}.json", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSanitizedFileName_WithTitleAndGuid_NoAppendGuidSetting()
|
||||
{
|
||||
// Arrange
|
||||
var mappingMock = new Mock<IMapping>();
|
||||
mappingMock.Setup(m => m.Title).Returns(MappingTitle);
|
||||
mappingMock.Setup(m => m.Guid).Returns(new Guid(MappingGuid));
|
||||
|
||||
var settings = new WireMockServerSettings
|
||||
{
|
||||
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
AppendGuidToSavedMappingFile = false
|
||||
}
|
||||
};
|
||||
|
||||
var sanitizer = new MappingFileNameSanitizer(settings);
|
||||
|
||||
// Act
|
||||
var result = sanitizer.BuildSanitizedFileName(mappingMock.Object);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("Proxy Mapping for _POST_ordermanagement_v1_orders_cancel.json", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSanitizedFileName_WithPrefix_AddsPrefix()
|
||||
{
|
||||
// Arrange
|
||||
var mappingMock = new Mock<IMapping>();
|
||||
mappingMock.Setup(m => m.Title).Returns(MappingTitle);
|
||||
mappingMock.Setup(m => m.Guid).Returns(new Guid(MappingGuid));
|
||||
|
||||
var settings = new WireMockServerSettings
|
||||
{
|
||||
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
PrefixForSavedMappingFile = "Prefix"
|
||||
}
|
||||
};
|
||||
|
||||
var sanitizer = new MappingFileNameSanitizer(settings);
|
||||
|
||||
// Act
|
||||
var result = sanitizer.BuildSanitizedFileName(mappingMock.Object);
|
||||
|
||||
// Assert
|
||||
Assert.Equal($"Prefix_POST_ordermanagement_v1_orders_cancel.json", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSanitizedFileName_WithPrefix_AddsPrefixEmptyString()
|
||||
{
|
||||
// Arrange
|
||||
var mappingMock = new Mock<IMapping>();
|
||||
mappingMock.Setup(m => m.Title).Returns(MappingTitle);
|
||||
mappingMock.Setup(m => m.Guid).Returns(new Guid(MappingGuid));
|
||||
|
||||
var settings = new WireMockServerSettings
|
||||
{
|
||||
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
PrefixForSavedMappingFile = string.Empty
|
||||
}
|
||||
};
|
||||
|
||||
var sanitizer = new MappingFileNameSanitizer(settings);
|
||||
|
||||
// Act
|
||||
var result = sanitizer.BuildSanitizedFileName(mappingMock.Object);
|
||||
|
||||
// Assert
|
||||
Assert.Equal($"POST_ordermanagement_v1_orders_cancel.json", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSanitizedFileName_WithTitleAndGuid_WithPrefixAndAppendGuidSetting()
|
||||
{
|
||||
// Arrange
|
||||
var mappingMock = new Mock<IMapping>();
|
||||
mappingMock.Setup(m => m.Title).Returns(MappingTitle);
|
||||
mappingMock.Setup(m => m.Guid).Returns(new Guid(MappingGuid));
|
||||
|
||||
var settings = new WireMockServerSettings
|
||||
{
|
||||
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
PrefixForSavedMappingFile = "Prefix",
|
||||
AppendGuidToSavedMappingFile = true
|
||||
}
|
||||
};
|
||||
|
||||
var sanitizer = new MappingFileNameSanitizer(settings);
|
||||
|
||||
// Act
|
||||
var result = sanitizer.BuildSanitizedFileName(mappingMock.Object);
|
||||
|
||||
// Assert
|
||||
Assert.Equal($"Prefix_POST_ordermanagement_v1_orders_cancel_{MappingGuid}.json", result);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
DetectedBodyType: String,
|
||||
DetectedBodyTypeFromContentType: Bytes
|
||||
},
|
||||
UseTransformer: true,
|
||||
TransformerReplaceNodeOptions: Evaluate
|
||||
UseTransformer: true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#if NET6_0_OR_GREATER
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using WireMock.Net.Testcontainers;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Testcontainers;
|
||||
|
||||
public class TestcontainersTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task WireMockContainer_Build_and_StartAsync_and_StopAsync()
|
||||
{
|
||||
// Act
|
||||
var wireMockContainer = new WireMockContainerBuilder()
|
||||
.WithAutoRemove(true)
|
||||
.WithCleanUp(true)
|
||||
.Build();
|
||||
|
||||
try
|
||||
{
|
||||
await wireMockContainer.StartAsync().ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
using (new AssertionScope())
|
||||
{
|
||||
var url = wireMockContainer.GetPublicUrl();
|
||||
url.Should().NotBeNullOrWhiteSpace();
|
||||
|
||||
var adminClient = wireMockContainer.CreateWireMockAdminClient();
|
||||
|
||||
var settings = await adminClient.GetSettingsAsync();
|
||||
settings.Should().NotBeNull();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
await wireMockContainer.StopAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using CultureAwareTesting.xUnit;
|
||||
using FluentAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Util;
|
||||
@@ -7,6 +9,179 @@ namespace WireMock.Net.Tests.Util;
|
||||
|
||||
public class StringUtilsTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("", "")]
|
||||
[InlineData("x", "x")]
|
||||
public void TryConvertToString_ShouldWorkCorrectly(string input, string expectedValue)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(false);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<bool>().And.Be(expectedValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("true", true, true)]
|
||||
[InlineData("false", false, true)]
|
||||
[InlineData("not a bool", false, false)] // Invalid case
|
||||
public void TryConvertToBool_ShouldWorkCorrectly(string input, bool expectedValue, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<bool>().And.Be(expectedValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("123", 123, true)]
|
||||
[InlineData("-456", -456, true)]
|
||||
[InlineData("not an int", 0, false)] // Invalid case
|
||||
public void TryConvertToInt_ShouldWorkCorrectly(string input, int expectedValue, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<int>().And.Be(expectedValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("12345678901", 12345678901L, true)]
|
||||
[InlineData("-9876543210", -9876543210L, true)]
|
||||
[InlineData("not a long", 0L, false)] // Invalid case
|
||||
public void TryConvertToLong_ShouldWorkCorrectly(string input, long expectedValue, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<long>().And.Be(expectedValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[CulturedTheory("en-US")]
|
||||
[InlineData("123.1", 123.1, true)]
|
||||
[InlineData("-456.1", -456.1, true)]
|
||||
[InlineData("not a double", 0.0, false)] // Invalid case
|
||||
public void TryConvertToDouble_ShouldWorkCorrectly(string input, double expectedValue, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
((double) convertedValue).Should().BeApproximately(expectedValue, 0.01);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("3F2504E0-4F89-11D3-9A0C-0305E82C3301", true)]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000", true)]
|
||||
[InlineData("3f2504e0-4f89-11d3-9a0c-0305e82c3301", true)] // Lowercase Guid
|
||||
[InlineData("not a guid", false)] // Invalid case
|
||||
public void TryConvertToGuid_ShouldWorkCorrectly(string input, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<Guid>();
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("2023-04-01", true)]
|
||||
[InlineData("01/01/2000", true)]
|
||||
[InlineData("not a date", false)] // Invalid case
|
||||
public void TryConvertToDateTime_ShouldWorkCorrectly(string input, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<DateTime>().And.Subject.As<DateTime>().Date.Should().Be(DateTime.Parse(input).Date);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("1.00:00:00", true)] // 1 day
|
||||
[InlineData("00:30:00", true)] // 30 minutes
|
||||
[InlineData("not a timespan", false)] // Invalid case
|
||||
public void TryConvertToTimeSpan_ShouldWorkCorrectly(string input, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<TimeSpan>().And.Subject.As<TimeSpan>().Should().Be(TimeSpan.Parse(input));
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("http://example.com", true)]
|
||||
[InlineData("https://example.com/path?query=string#fragment", true)]
|
||||
[InlineData("ftp://example.com", true)]
|
||||
[InlineData("file://example.com", false)]
|
||||
[InlineData("not a uri", false)] // Invalid case
|
||||
public void TryConvertToUri_ShouldWorkCorrectly(string input, bool expectedConversion)
|
||||
{
|
||||
var (isConverted, convertedValue) = StringUtils.TryConvertToKnownType(input);
|
||||
|
||||
isConverted.Should().Be(expectedConversion);
|
||||
if (isConverted)
|
||||
{
|
||||
convertedValue.Should().BeOfType<Uri>().And.Subject.As<Uri>().AbsoluteUri.Should().Be(new Uri(input).AbsoluteUri);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedValue.Should().Be(input);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("And", MatchOperator.And)]
|
||||
[InlineData("Or", MatchOperator.Or)]
|
||||
|
||||
@@ -105,6 +105,10 @@
|
||||
<PackageReference Include="JsonConverter.System.Text.Json" Version="0.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
|
||||
<ProjectReference Include="..\..\src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="OpenApiParser\*.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
Guid: 90356dba-b36c-469a-a17e-669cd84f1f05,
|
||||
UpdatedAt: DateTime_1,
|
||||
Request: {
|
||||
Path: {
|
||||
Matchers: [
|
||||
{
|
||||
Name: WildcardMatcher,
|
||||
Pattern: /1,
|
||||
IgnoreCase: false
|
||||
}
|
||||
]
|
||||
},
|
||||
Body: {
|
||||
Matcher: {
|
||||
Name: RegexMatcher,
|
||||
Pattern: hello,
|
||||
IgnoreCase: true
|
||||
}
|
||||
}
|
||||
},
|
||||
Response: {
|
||||
ProxyUrl: https://my-proxy.com,
|
||||
ProxyUrlReplaceSettings: {
|
||||
OldValue: x,
|
||||
NewValue: y,
|
||||
IgnoreCase: true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -25,6 +26,7 @@ using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Types;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests;
|
||||
@@ -234,6 +236,10 @@ public class WireMockAdminApiTests
|
||||
StartAdminInterface = true,
|
||||
Logger = new WireMockNullLogger()
|
||||
});
|
||||
server
|
||||
.Given(Request.Create().WithPath("/foo").UsingGet())
|
||||
.RespondWith(Response.Create());
|
||||
|
||||
var serverUrl = "http://localhost:" + server.Ports[0];
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
@@ -242,11 +248,94 @@ public class WireMockAdminApiTests
|
||||
var requests = await api.FindRequestsAsync(new RequestModel { Methods = new[] { "GET" } }).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
Check.That(requests).HasSize(1);
|
||||
requests.Should().HaveCount(1);
|
||||
var requestLogged = requests.First();
|
||||
Check.That(requestLogged.Request.Method).IsEqualTo("GET");
|
||||
Check.That(requestLogged.Request.Body).IsNull();
|
||||
Check.That(requestLogged.Request.Path).IsEqualTo("/foo");
|
||||
requestLogged.Request.Method.Should().Be("GET");
|
||||
requestLogged.Request.Body.Should().BeNull();
|
||||
requestLogged.Request.Path.Should().Be("/foo");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_FindRequestsByMappingGuidAsync_Found()
|
||||
{
|
||||
// Arrange
|
||||
var mappingGuid = Guid.NewGuid();
|
||||
var server = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
StartAdminInterface = true,
|
||||
Logger = new WireMockNullLogger()
|
||||
});
|
||||
server
|
||||
.Given(Request.Create().WithPath("/foo").UsingGet())
|
||||
.WithGuid(mappingGuid)
|
||||
.RespondWith(Response.Create());
|
||||
|
||||
var serverUrl = "http://localhost:" + server.Ports[0];
|
||||
using var client = new HttpClient();
|
||||
await client.GetAsync(serverUrl + "/foo").ConfigureAwait(false);
|
||||
await client.GetAsync(serverUrl + "/foo?bar=baz").ConfigureAwait(false);
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var logEntryModels = await api.FindRequestsByMappingGuidAsync(mappingGuid).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
logEntryModels.Should().HaveCount(2);
|
||||
logEntryModels[0].Should().NotBeNull();
|
||||
logEntryModels[0]!.Request.Method.Should().Be("GET");
|
||||
logEntryModels[0]!.Request.Body.Should().BeNull();
|
||||
logEntryModels[0]!.Request.Path.Should().Be("/foo");
|
||||
logEntryModels[0]!.Request.Query.Should().BeNullOrEmpty();
|
||||
logEntryModels[1].Should().NotBeNull();
|
||||
logEntryModels[1]!.Request.Method.Should().Be("GET");
|
||||
logEntryModels[1]!.Request.Body.Should().BeNull();
|
||||
logEntryModels[1]!.Request.Path.Should().Be("/foo");
|
||||
logEntryModels[1]!.Request.Query.Should().BeEquivalentTo(new Dictionary<string, WireMockList<string>>
|
||||
{
|
||||
{"bar", new WireMockList<string>("baz")}
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_FindRequestsByMappingGuidAsync_NotFound()
|
||||
{
|
||||
// Arrange
|
||||
var server = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
StartAdminInterface = true,
|
||||
Logger = new WireMockNullLogger()
|
||||
});
|
||||
server
|
||||
.Given(Request.Create().WithPath("/foo").UsingGet())
|
||||
.WithGuid(Guid.NewGuid())
|
||||
.RespondWith(Response.Create());
|
||||
|
||||
var serverUrl = "http://localhost:" + server.Ports[0];
|
||||
await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
// Act
|
||||
var logEntryModels = await api.FindRequestsByMappingGuidAsync(Guid.NewGuid()).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
logEntryModels.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_FindRequestsByMappingGuidAsync_Invalid_ShouldReturnBadRequest()
|
||||
{
|
||||
// Arrange
|
||||
var server = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
StartAdminInterface = true,
|
||||
Logger = new WireMockNullLogger()
|
||||
});
|
||||
|
||||
// Act
|
||||
var result = await server.CreateClient().GetAsync("/__admin/requests/find?mappingGuid=x");
|
||||
|
||||
// Assert
|
||||
result.StatusCode.Should().Be(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -351,6 +440,57 @@ public class WireMockAdminApiTests
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_GetMappingAsync_WithProxy_And_ProxyUrlReplaceSettings()
|
||||
{
|
||||
// Arrange
|
||||
var guid = Guid.Parse("90356dba-b36c-469a-a17e-669cd84f1f05");
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var model = new MappingModel
|
||||
{
|
||||
Guid = guid,
|
||||
Request = new RequestModel
|
||||
{
|
||||
Path = "/1",
|
||||
Body = new BodyModel
|
||||
{
|
||||
Matcher = new MatcherModel
|
||||
{
|
||||
Name = "RegexMatcher",
|
||||
Pattern = "hello",
|
||||
IgnoreCase = true
|
||||
}
|
||||
}
|
||||
},
|
||||
Response = new ResponseModel
|
||||
{
|
||||
ProxyUrl = "https://my-proxy.com",
|
||||
ProxyUrlReplaceSettings = new ProxyUrlReplaceSettingsModel
|
||||
{
|
||||
OldValue = "x",
|
||||
NewValue = "y",
|
||||
IgnoreCase = true
|
||||
}
|
||||
}
|
||||
};
|
||||
var postMappingResult = await api.PostMappingAsync(model).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
postMappingResult.Should().NotBeNull();
|
||||
|
||||
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
|
||||
mapping.Should().NotBeNull();
|
||||
|
||||
var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
|
||||
|
||||
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_GetRequestsAsync_Json()
|
||||
{
|
||||
@@ -764,7 +904,7 @@ public class WireMockAdminApiTests
|
||||
.RespondWith(
|
||||
Response.Create()
|
||||
.WithStatusCode(HttpStatusCode.AlreadyReported)
|
||||
.WithBodyAsJson(new { @as = 1, b=1.2, d=true, e=false, f=new[]{1,2,3,4}, g= new{z1=1, z2=2, z3=new []{"a","b","c"}, z4=new[]{new {a=1, b=2},new {a=2, b=3}}}, date_field = new DateTime(2023,05,08,11,20,19), string_field_with_date="2021-03-13T21:04:00Z", multiline_text= @"This
|
||||
.WithBodyAsJson(new { @as = 1, b = 1.2, d = true, e = false, f = new[] { 1, 2, 3, 4 }, g = new { z1 = 1, z2 = 2, z3 = new[] { "a", "b", "c" }, z4 = new[] { new { a = 1, b = 2 }, new { a = 2, b = 3 } } }, date_field = new DateTime(2023, 05, 08, 11, 20, 19), string_field_with_date = "2021-03-13T21:04:00Z", multiline_text = @"This
|
||||
is
|
||||
multiline
|
||||
text
|
||||
@@ -775,7 +915,7 @@ text
|
||||
.Given(
|
||||
Request.Create()
|
||||
.WithPath("/foo3")
|
||||
.WithBody(new JsonPartialMatcher(new { a=1, b=2}))
|
||||
.WithBody(new JsonPartialMatcher(new { a = 1, b = 2 }))
|
||||
.UsingPost()
|
||||
)
|
||||
.WithGuid(guid4)
|
||||
@@ -875,4 +1015,4 @@ text
|
||||
server.Stop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -117,7 +117,7 @@ public class WireMockServerProxyTests
|
||||
}
|
||||
|
||||
// Assert
|
||||
server.Mappings.Should().HaveCount(34);
|
||||
server.Mappings.Should().HaveCount(35);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -174,7 +174,7 @@ public class WireMockServerProxyTests
|
||||
server.Mappings.Should().HaveCount(2);
|
||||
|
||||
// Verify
|
||||
fileSystemHandlerMock.Verify(f => f.WriteMappingFile($"m{System.IO.Path.DirectorySeparatorChar}{title}.json", It.IsRegex(stringBody)), Times.Once);
|
||||
fileSystemHandlerMock.Verify(f => f.WriteMappingFile($"m{System.IO.Path.DirectorySeparatorChar}Proxy Mapping for _{title}.json", It.IsRegex(stringBody)), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -922,4 +922,49 @@ public class WireMockServerProxyTests
|
||||
server.LogEntries.Should().HaveCount(1);
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WireMockServer_ProxyAndRecordSettings_SameRequest_ShouldProxyAll()
|
||||
{
|
||||
//Arrange
|
||||
var wireMockServerSettings = new WireMockServerSettings
|
||||
{
|
||||
Urls = new[] { "http://localhost:9091" },
|
||||
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||
{
|
||||
Url = "http://postman-echo.com",
|
||||
SaveMapping = true,
|
||||
ProxyAll = true,
|
||||
SaveMappingToFile = false,
|
||||
ExcludedHeaders = new[] { "Postman-Token" },
|
||||
ExcludedCookies = new[] { "sails.sid" }
|
||||
}
|
||||
};
|
||||
|
||||
var server = WireMockServer.Start(wireMockServerSettings);
|
||||
|
||||
var requestBody = "{\"key1\": \"value1\", \"key2\": \"value2\"}";
|
||||
var request = new HttpRequestMessage
|
||||
{
|
||||
Method = HttpMethod.Post,
|
||||
RequestUri = new Uri("http://localhost:9091/post"),
|
||||
Content = new StringContent(requestBody)
|
||||
};
|
||||
var request2 = new HttpRequestMessage
|
||||
{
|
||||
Method = HttpMethod.Post,
|
||||
RequestUri = new Uri("http://localhost:9091/post"),
|
||||
Content = new StringContent(requestBody)
|
||||
};
|
||||
server.ResetMappings();
|
||||
|
||||
//Act
|
||||
await new HttpClient().SendAsync(request);
|
||||
await new HttpClient().SendAsync(request2);
|
||||
|
||||
//Assert
|
||||
Check.That(server.Mappings.Count()).IsEqualTo(3);
|
||||
|
||||
server.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class WireMockServerSettingsTests
|
||||
|
||||
// Assert
|
||||
server.Mappings.Should().NotBeNull();
|
||||
server.Mappings.Should().HaveCount(32);
|
||||
server.Mappings.Should().HaveCount(33);
|
||||
server.Mappings.All(m => m.Priority == WireMockConstants.AdminPriority).Should().BeTrue();
|
||||
}
|
||||
|
||||
@@ -100,9 +100,9 @@ public class WireMockServerSettingsTests
|
||||
|
||||
// Assert
|
||||
server.Mappings.Should().NotBeNull();
|
||||
server.Mappings.Should().HaveCount(33);
|
||||
server.Mappings.Should().HaveCount(34);
|
||||
|
||||
server.Mappings.Count(m => m.Priority == WireMockConstants.AdminPriority).Should().Be(32);
|
||||
server.Mappings.Count(m => m.Priority == WireMockConstants.AdminPriority).Should().Be(33);
|
||||
server.Mappings.Count(m => m.Priority == WireMockConstants.ProxyPriority).Should().Be(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user