Files
WireMock.Net-wiremock/examples/Issue1553.cs
T
Stef HeyenrathandCopilot Autofix powered by AI 5c6ceebd48 Only load MimeKitUtils when request message is multipart (#1554)
* Only load MimeKitUtils when request message is multipart

* preload

* Potential fix for pull request finding 'Missing Dispose call on local IDisposable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-12-06 15:50:26 +01:00

20 lines
736 B
C#

// #: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()}");