mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-12-06 15:06:45 +01:00
Only load MimeKitUtils when request message is multipart
This commit is contained in:
1 parent
3f3e576750
commit
acbc33f04e
8 files changed
+122
-41
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<MsBuildAllProjects>$(MsBuildAllProjects);$(MsBuildThisFileFullPath)</MsBuildAllProjects>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,20 @@
|
||||
// #:package WireMock.Net@2.35.0
|
||||
#:project ../src/WireMock.Net/WireMock.Net.csproj
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
|
||||
static bool MimePluginLoaded() => AppDomain.CurrentDomain.GetAssemblies()
|
||||
.Any(a => a.GetName().Name == "WireMock.Net.MimePart");
|
||||
|
||||
using var server = WireMockServer.Start();
|
||||
server.Given(Request.Create().WithPath("/ping").UsingGet())
|
||||
.RespondWith(Response.Create().WithStatusCode(200));
|
||||
|
||||
using var client = server.CreateClient();
|
||||
Console.WriteLine($"Before GET: {MimePluginLoaded()}");
|
||||
using var response = await client.GetAsync("/ping");
|
||||
Console.WriteLine($"After GET ({(int)response.StatusCode}): {MimePluginLoaded()}");
|
||||
Reference in new issue
Block a user