diff --git a/WireMock.Net Solution.sln b/WireMock.Net Solution.sln
index 26df8868..bd8230f5 100644
--- a/WireMock.Net Solution.sln
+++ b/WireMock.Net Solution.sln
@@ -42,8 +42,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.StandAlone.Net
{B6269AAC-170A-43D5-8B9A-579DED3D9A95} = {B6269AAC-170A-43D5-8B9A-579DED3D9A95}
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.ConsoleTest.Net452", "examples\WireMock.Net.ConsoleTest.Net452\WireMock.Net.ConsoleTest.Net452.csproj", "{B5F1A150-37E1-434D-929F-FAD5AC428107}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -86,10 +84,6 @@ Global
{668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.Build.0 = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.ActiveCfg = Release|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.Build.0 = Release|Any CPU
- {B5F1A150-37E1-434D-929F-FAD5AC428107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B5F1A150-37E1-434D-929F-FAD5AC428107}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B5F1A150-37E1-434D-929F-FAD5AC428107}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B5F1A150-37E1-434D-929F-FAD5AC428107}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -104,6 +98,5 @@ Global
{B6269AAC-170A-43D5-8B9A-579DED3D9A95} = {EF242EDF-7133-4277-9A0C-18744DE08707}
{10E16614-61CA-48D8-8BDD-664C13913DED} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A}
{668F689E-57B4-422E-8846-C0FF643CA999} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A}
- {B5F1A150-37E1-434D-929F-FAD5AC428107} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A}
EndGlobalSection
EndGlobal
diff --git a/examples/WireMock.Net.ConsoleTest.Net452/App.config b/examples/WireMock.Net.ConsoleTest.Net452/App.config
deleted file mode 100644
index 71a06ba3..00000000
--- a/examples/WireMock.Net.ConsoleTest.Net452/App.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/WireMock.Net.ConsoleTest.Net452/Program.cs b/examples/WireMock.Net.ConsoleTest.Net452/Program.cs
deleted file mode 100644
index 8677e233..00000000
--- a/examples/WireMock.Net.ConsoleTest.Net452/Program.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using WireMock.Net.StandAlone;
-
-namespace WireMock.Net.ConsoleTest.Net452
-{
- class Program
- {
- static void Main(string[] args)
- {
- StandAloneApp.Start(args);
-
- Console.WriteLine("Press any key to stop the server");
- Console.ReadKey();
- }
- }
-}
\ No newline at end of file
diff --git a/examples/WireMock.Net.ConsoleTest.Net452/Properties/AssemblyInfo.cs b/examples/WireMock.Net.ConsoleTest.Net452/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1459d105..00000000
--- a/examples/WireMock.Net.ConsoleTest.Net452/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("WireMock.Net.ConsoleTest.Net452")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("WireMock.Net.ConsoleTest.Net452")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b5f1a150-37e1-434d-929f-fad5ac428107")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/examples/WireMock.Net.ConsoleTest.Net452/WireMock.Net.ConsoleTest.Net452.csproj b/examples/WireMock.Net.ConsoleTest.Net452/WireMock.Net.ConsoleTest.Net452.csproj
deleted file mode 100644
index 10d0b81c..00000000
--- a/examples/WireMock.Net.ConsoleTest.Net452/WireMock.Net.ConsoleTest.Net452.csproj
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {B5F1A150-37E1-434D-929F-FAD5AC428107}
- Exe
- WireMock.Net.ConsoleTest.Net452
- WireMock.Net.ConsoleTest.Net452
- v4.5.2
- 512
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\packages\CommandLineArgumentsParser.3.0.11\lib\net45\CommandLineArgumentsParser.dll
-
-
- ..\..\packages\Handlebars.Net.1.9.0\lib\net40\Handlebars.dll
-
-
- ..\..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll
-
-
- ..\..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll
-
-
- ..\..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll
-
-
- ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
-
-
- ..\..\packages\Owin.1.0\lib\net40\Owin.dll
-
-
- ..\..\packages\RestEase.1.4.1\lib\net45\RestEase.dll
-
-
- ..\..\packages\SimMetrics.Net.1.0.3\lib\net45\SimMetrics.Net.dll
-
-
-
-
- ..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll
-
-
-
- ..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll
-
-
- ..\..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll
-
-
-
-
-
-
-
-
- ..\..\packages\WireMock.Net.1.0.2.1\lib\net452\WireMock.Net.dll
-
-
- ..\..\packages\WireMock.Net.StandAlone.1.0.0\lib\net452\WireMock.Net.StandAlone.dll
-
-
- ..\..\packages\XPath2.1.0.3.1\lib\net452\XPath2.dll
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/WireMock.Net.ConsoleTest.Net452/packages.config b/examples/WireMock.Net.ConsoleTest.Net452/packages.config
deleted file mode 100644
index 923138e5..00000000
--- a/examples/WireMock.Net.ConsoleTest.Net452/packages.config
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/WireMock.Net/Client/IFluentMockServerAdmin.cs b/src/WireMock.Net/Client/IFluentMockServerAdmin.cs
index 4bfe56f8..d5e53414 100644
--- a/src/WireMock.Net/Client/IFluentMockServerAdmin.cs
+++ b/src/WireMock.Net/Client/IFluentMockServerAdmin.cs
@@ -131,5 +131,12 @@ namespace WireMock.Client
/// The Guid
[Delete("__admin/requests/{guid}")]
Task DeleteRequestAsync([Path] Guid guid);
+
+ ///
+ /// Find a request based on the criteria
+ ///
+ /// The RequestModel
+ [Post("__admin/requests/find")]
+ Task> FindRequestsAsync([Body] RequestModel model);
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net/Http/CertificateUtil.cs b/src/WireMock.Net/Http/CertificateUtil.cs
index 66211225..819792a4 100644
--- a/src/WireMock.Net/Http/CertificateUtil.cs
+++ b/src/WireMock.Net/Http/CertificateUtil.cs
@@ -30,15 +30,12 @@ namespace WireMock.Http
}
finally
{
- if (certStore != null)
- {
#if NETSTANDARD || NET46
- certStore.Dispose();
+ certStore.Dispose();
#else
- certStore.Close();
+ certStore.Close();
#endif
- }
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/WireMock.Net/Http/HttpClientHelper.cs b/src/WireMock.Net/Http/HttpClientHelper.cs
index d30fb101..2f4eac1a 100644
--- a/src/WireMock.Net/Http/HttpClientHelper.cs
+++ b/src/WireMock.Net/Http/HttpClientHelper.cs
@@ -10,7 +10,7 @@ namespace WireMock.Http
{
internal static class HttpClientHelper
{
-
+
private static HttpClient CreateHttpClient(string clientX509Certificate2ThumbprintOrSubjectName = null)
{
if (!string.IsNullOrEmpty(clientX509Certificate2ThumbprintOrSubjectName))
@@ -69,29 +69,22 @@ namespace WireMock.Http
}
// Call the URL
- try
+ var httpResponseMessage = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead);
+
+
+ // Transform response
+ var responseMessage = new ResponseMessage
{
- var httpResponseMessage = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead);
+ StatusCode = (int)httpResponseMessage.StatusCode,
+ Body = await httpResponseMessage.Content.ReadAsStringAsync()
+ };
-
- // Transform response
- var responseMessage = new ResponseMessage
- {
- StatusCode = (int)httpResponseMessage.StatusCode,
- Body = await httpResponseMessage.Content.ReadAsStringAsync()
- };
-
- foreach (var header in httpResponseMessage.Headers)
- {
- responseMessage.AddHeader(header.Key, header.Value.FirstOrDefault());
- }
-
- return responseMessage;
- }
- catch(Exception ex)
+ foreach (var header in httpResponseMessage.Headers)
{
- throw ex;
+ responseMessage.AddHeader(header.Key, header.Value.FirstOrDefault());
}
+
+ return responseMessage;
}
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net/Owin/OwinSelfHost.cs b/src/WireMock.Net/Owin/OwinSelfHost.cs
index eb8588be..bfdde820 100644
--- a/src/WireMock.Net/Owin/OwinSelfHost.cs
+++ b/src/WireMock.Net/Owin/OwinSelfHost.cs
@@ -44,12 +44,6 @@ namespace WireMock.Owin
{
StartServers();
}, _cts.Token);
-
- //if (_internalThread != null)
- // throw new InvalidOperationException("Cannot start a multiple threads.");
-
- //_internalThread = new Thread(ThreadWorkInternal);
- //_internalThread.Start();
}
[PublicAPI]
@@ -72,22 +66,6 @@ namespace WireMock.Owin
return tcs.Task;
}
- private void ThreadWorkInternal()
- {
- try
- {
- StartServers();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex);
- }
- finally
- {
- _internalThread = null;
- }
- }
-
private void StartServers()
{
Action startup = app =>
diff --git a/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs b/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs
index bb5a7d81..0152baa7 100644
--- a/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs
+++ b/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs
@@ -7,19 +7,12 @@ namespace WireMock.ResponseBuilders
///
public interface IProxyResponseBuilder : IStatusCodeResponseBuilder
{
- ///
- /// With Proxy URL.
- ///
- /// The proxy url.
- /// A .
- IResponseBuilder WithProxy([NotNull] string proxyUrl);
-
///
/// With Proxy URL using X509Certificate2.
///
/// The proxy url.
/// The X509Certificate2 file to use for client authentication.
/// A .
- IResponseBuilder WithProxy([NotNull] string proxyUrl, [CanBeNull] string clientX509Certificate2ThumbprintOrSubjectName);
+ IResponseBuilder WithProxy([NotNull] string proxyUrl, [CanBeNull] string clientX509Certificate2ThumbprintOrSubjectName = null);
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net/ResponseBuilders/Response.cs b/src/WireMock.Net/ResponseBuilders/Response.cs
index 08b7cb3a..eab40e34 100644
--- a/src/WireMock.Net/ResponseBuilders/Response.cs
+++ b/src/WireMock.Net/ResponseBuilders/Response.cs
@@ -37,7 +37,7 @@ namespace WireMock.ResponseBuilders
///
/// The client X509Certificate2 Thumbprint or SubjectName to use.
///
- public string X509Certificate2ThumbprintOrSubjectName { get; private set; }
+ public string X509Certificate2ThumbprintOrSubjectName { get; private set; }
///
/// Gets the response message.
@@ -241,30 +241,15 @@ namespace WireMock.ResponseBuilders
return WithDelay(TimeSpan.FromMilliseconds(milliseconds));
}
- ///
- /// With Proxy URL.
- ///
- /// The proxy url.
- /// A .
- [PublicAPI]
- public IResponseBuilder WithProxy([NotNull] string proxyUrl)
- {
- Check.NotEmpty(proxyUrl, nameof(proxyUrl));
-
- ProxyUrl = proxyUrl;
- return this;
- }
-
///
/// With Proxy URL.
///
/// The proxy url.
/// The X509Certificate2 file to use for client authentication.
/// A .
- public IResponseBuilder WithProxy([NotNull] string proxyUrl, [NotNull] string clientX509Certificate2ThumbprintOrSubjectName)
+ public IResponseBuilder WithProxy(string proxyUrl, string clientX509Certificate2ThumbprintOrSubjectName = null)
{
Check.NotEmpty(proxyUrl, nameof(proxyUrl));
- Check.NotEmpty(clientX509Certificate2ThumbprintOrSubjectName, nameof(clientX509Certificate2ThumbprintOrSubjectName));
ProxyUrl = proxyUrl;
X509Certificate2ThumbprintOrSubjectName = clientX509Certificate2ThumbprintOrSubjectName;
diff --git a/src/WireMock.Net/Server/FluentMockServer.Admin.cs b/src/WireMock.Net/Server/FluentMockServer.Admin.cs
index 59800ea2..9f945375 100644
--- a/src/WireMock.Net/Server/FluentMockServer.Admin.cs
+++ b/src/WireMock.Net/Server/FluentMockServer.Admin.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Text;
using JetBrains.Annotations;
using Newtonsoft.Json;
-using SimMetrics.Net;
using WireMock.Admin.Mappings;
using WireMock.Admin.Requests;
using WireMock.Admin.Settings;
@@ -431,7 +430,9 @@ namespace WireMock.Server
{
var requestMatchResult = new RequestMatchResult();
if (request.GetMatchingScore(logEntry.RequestMessage, requestMatchResult) > 0.99)
+ {
dict.Add(logEntry, requestMatchResult);
+ }
}
var result = dict.OrderBy(x => x.Value.AverageTotalScore).Select(x => x.Key);
diff --git a/src/WireMock.Net/Server/IRespondWithAProvider.cs b/src/WireMock.Net/Server/IRespondWithAProvider.cs
index 65287283..33a31579 100644
--- a/src/WireMock.Net/Server/IRespondWithAProvider.cs
+++ b/src/WireMock.Net/Server/IRespondWithAProvider.cs
@@ -1,5 +1,4 @@
using System;
-using System.Threading.Tasks;
namespace WireMock.Server
{
@@ -41,11 +40,5 @@ namespace WireMock.Server
///
/// The provider.
void RespondWith(IResponseProvider provider);
-
- /////
- ///// The respond with.
- /////
- ///// The provider.
- //Task RespondWithAsync(IResponseProvider provider);
}
}
\ No newline at end of file