From 195ada4d511eaa6746b67c9f22e98d5a2181daf0 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Tue, 11 Feb 2020 08:54:23 +0100 Subject: [PATCH] Updated Request Matching (markdown) --- Request-Matching.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Request-Matching.md b/Request-Matching.md index bb625c3..7295274 100644 --- a/Request-Matching.md +++ b/Request-Matching.md @@ -570,4 +570,40 @@ server .RespondWith(Response.Create() .WithStatusCode(HttpStatusCode.Unauthorized) .WithBody(@"{ ""result"": ""api-key missing""}")); +``` + +A JSON Mapping example looks like: +``` json +{ + "Guid": "29971ff8-4adb-4ec7-8b7d-a2ce6e5ca630", + "Request": { + "Path": { + "Matchers": [ + { + "Name": "WildcardMatcher", + "Pattern": "/doesnot-need-a-key" + } + ] + }, + "Headers": [ + { + "Name": "api-key", + "Matchers": [ + { + "Name": "WildcardMatcher", + "Pattern": "*", + "IgnoreCase": true, + "RejectOnMatch": true + } + ] + } + ] + }, + "Response": { + "StatusCode": 401, + "BodyDestination": "SameAsSource", + "Body": "{ \"result\": \"api-key missing\"}", + "Headers": {} + } +} ``` \ No newline at end of file