From 7fa0fbf7da4adbe753181aeacb9b3f9b7b5e9649 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Sun, 12 Feb 2017 10:10:46 +0100 Subject: [PATCH] /reset --- examples/WireMock.Net.ConsoleApplication/Program.cs | 1 - src/WireMock.Net/Server/FluentMockServer.Admin.cs | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/WireMock.Net.ConsoleApplication/Program.cs b/examples/WireMock.Net.ConsoleApplication/Program.cs index cf0be467..a6dd3fb3 100644 --- a/examples/WireMock.Net.ConsoleApplication/Program.cs +++ b/examples/WireMock.Net.ConsoleApplication/Program.cs @@ -87,7 +87,6 @@ namespace WireMock.Net.ConsoleApplication .WithHeader("Transformed-Postman-Token", "token is {{request.headers.Postman-Token}}") .WithBody(@"{""msg"": ""Hello world CATCH-ALL on /*, {{request.path}}, bykey={{request.query.start}}, bykey={{request.query.stop}}, byidx0={{request.query.stop.[0]}}, byidx1={{request.query.stop.[1]}}"" }") .WithTransformer() - .WithDelay(1000) .WithDelay(TimeSpan.FromMilliseconds(100)) ); diff --git a/src/WireMock.Net/Server/FluentMockServer.Admin.cs b/src/WireMock.Net/Server/FluentMockServer.Admin.cs index b4ec3f71..9e3d2f95 100644 --- a/src/WireMock.Net/Server/FluentMockServer.Admin.cs +++ b/src/WireMock.Net/Server/FluentMockServer.Admin.cs @@ -53,19 +53,25 @@ namespace WireMock.Server Given(Request.Create().WithPath(AdminMappings).UsingPost()).RespondWith(new DynamicResponseProvider(MappingsPost)); Given(Request.Create().WithPath(AdminMappings).UsingDelete()).RespondWith(new DynamicResponseProvider(MappingsDelete)); + // __admin/mappings/reset + Given(Request.Create().WithPath(AdminMappings + "/reset").UsingPost()).RespondWith(new DynamicResponseProvider(MappingsDelete)); + // __admin/mappings/{guid} Given(Request.Create().WithPath(_adminMappingsGuidPathMatcher).UsingGet()).RespondWith(new DynamicResponseProvider(MappingGet)); Given(Request.Create().WithPath(_adminMappingsGuidPathMatcher).UsingPut().WithHeader("Content-Type", "application/json")).RespondWith(new DynamicResponseProvider(MappingPut)); Given(Request.Create().WithPath(_adminMappingsGuidPathMatcher).UsingDelete()).RespondWith(new DynamicResponseProvider(MappingDelete)); - // __admin/mappings/save Given(Request.Create().WithPath(AdminMappings + "/save").UsingPost()).RespondWith(new DynamicResponseProvider(MappingsSave)); + // __admin/requests Given(Request.Create().WithPath(AdminRequests).UsingGet()).RespondWith(new DynamicResponseProvider(RequestsGet)); Given(Request.Create().WithPath(AdminRequests).UsingDelete()).RespondWith(new DynamicResponseProvider(RequestsDelete)); + // __admin/requests/reset + Given(Request.Create().WithPath(AdminRequests + "/reset").UsingPost()).RespondWith(new DynamicResponseProvider(RequestsDelete)); + // __admin/request/{guid} Given(Request.Create().WithPath(_adminRequestsGuidPathMatcher).UsingGet()).RespondWith(new DynamicResponseProvider(RequestGet)); Given(Request.Create().WithPath(_adminRequestsGuidPathMatcher).UsingDelete()).RespondWith(new DynamicResponseProvider(RequestDelete)); @@ -362,7 +368,7 @@ namespace WireMock.Server if (mappingModel.Response.UseTransformer) responseBuilder = responseBuilder.WithTransformer(); - if (mappingModel.Response.Delay != null) + if (mappingModel.Response.Delay > 0) responseBuilder = responseBuilder.WithDelay(mappingModel.Response.Delay.Value); return responseBuilder;