You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My application talks to an external (central) API (SaltBae), and from SaltBae I receive a list of different servers (SteakServers). In my integration tests, I intercept all requests going to SaltBae with httpclient-interception and all SteakServers are mocked and created by using WireMock.Net. The HttpClient used for the testing is created from _clientOptions.CreateHttpClient(); and is injected with Autofac in my test setup. This all works nicely so far.
The problem:
However, to make the above work I had to set ThrowOnMissingRegistration to false because httpclient-interception would throw on requests that are meant to be handled by WireMock.Net. But I would still like to have ThrowOnMissingRegistration = true while it ignores any requests that go to any of the Steak servers. ThrowOnMissingRegistration is very useful while writing tests as it shows exactly which requests still need to be mocked.
Describe the solution you'd like
Basically use the fluent API for creating requests that are then added to a special property IgnoredRequests, which are then taken into account before throwing an MissingRegistrationException
I also tried moving away from httpclient-interception and replace that with WireMock.Net but that caused more problems as the urls werent intercepted anymore and httpclient-interception is just exactly what I need.
Additional context
Nope
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm using httpclient-interception and WireMock.Net together.
The scenario:
My application talks to an external (central) API (SaltBae), and from SaltBae I receive a list of different servers (SteakServers). In my integration tests, I intercept all requests going to SaltBae with
httpclient-interception
and all SteakServers are mocked and created by usingWireMock.Net
. TheHttpClient
used for the testing is created from_clientOptions.CreateHttpClient();
and is injected with Autofac in my test setup. This all works nicely so far.The problem:
However, to make the above work I had to set
ThrowOnMissingRegistration
tofalse
becausehttpclient-interception
would throw on requests that are meant to be handled byWireMock.Net
. But I would still like to haveThrowOnMissingRegistration = true
while it ignores any requests that go to any of the Steak servers.ThrowOnMissingRegistration
is very useful while writing tests as it shows exactly which requests still need to be mocked.Describe the solution you'd like
Basically use the fluent API for creating requests that are then added to a special property
IgnoredRequests
, which are then taken into account before throwing anMissingRegistrationException
or a simpler solution might be a property that set all requests to localhost to be ignored by the
MissingRegistrationException
Describe alternatives you've considered
I tried the following to whitelist all localhost requests but that still intercepts the requests and doesn't return any response
I also tried moving away from httpclient-interception and replace that with WireMock.Net but that caused more problems as the urls werent intercepted anymore and
httpclient-interception
is just exactly what I need.Additional context
Nope
The text was updated successfully, but these errors were encountered: