mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Wiremock: As IServer? #644
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AliWaja on GitHub (Nov 12, 2024).
Originally assigned to: @StefH on GitHub.
I want to be able to create a service that uses Wiremock as the actual server (overrides the default kestrel server), using something like UseServer shown here
Is this functionality already provided?
My only other option seems to be writing some middleware that parses the request to my service, copy the request data and pass it to Wiremock, then parses the Wiremock response into an HTTP response and returns...
Any recommendations?
@StefH commented on GitHub (Nov 12, 2024):
I'm not 100% sure, but there is a middleware project (https://www.nuget.org/packages/WireMock.Net.AspNetCore.Middleware) which can be used to host WireMock.Net inside your running ASPNetCore server so that HTTP Requests going to a real API will be redirected to WireMock.Net
For an scenario see this project:
https://github.com/WireMock-Net/WireMock.Net/tree/master/test/WireMock.Net.TestWebApplication
And see this unit (integration) test:
https://github.com/WireMock-Net/WireMock.Net/tree/master/test/WireMock.Net.Middleware.Tests
@AliWaja commented on GitHub (Nov 13, 2024):
Thanks, this helps!