Only load MimeKitUtils when request message is multipart

This commit is contained in:
Stef Heyenrath committed 2026-12-06 08:53:32 +01:00
1 parent 3f3e576750
commit acbc33f04e
8 files changed
+122 -41

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
<Project>
<PropertyGroup>
<MsBuildAllProjects>$(MsBuildAllProjects);$(MsBuildThisFileFullPath)</MsBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
+20
View File
@@ -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()}");