From d9a7e80360ac4a266971c4616ff76dab146ded60 Mon Sep 17 00:00:00 2001 From: jollyjoyce1995 Date: Wed, 23 Apr 2025 07:30:52 +0200 Subject: [PATCH] changed null check in JSONPathMatcher and JmesPathMatcher to ensure that the body is not an empty string (the json parse would throw an exception at this point) (#1278) --- src/WireMock.Net/Matchers/JSONPathMatcher.cs | 2 +- src/WireMock.Net/Matchers/JmesPathMatcher.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WireMock.Net/Matchers/JSONPathMatcher.cs b/src/WireMock.Net/Matchers/JSONPathMatcher.cs index 21f78ea3..14eccf19 100644 --- a/src/WireMock.Net/Matchers/JSONPathMatcher.cs +++ b/src/WireMock.Net/Matchers/JSONPathMatcher.cs @@ -67,7 +67,7 @@ public class JsonPathMatcher : IStringMatcher, IObjectMatcher var score = MatchScores.Mismatch; Exception? exception = null; - if (input != null) + if (!string.IsNullOrWhiteSpace(input)) { try { diff --git a/src/WireMock.Net/Matchers/JmesPathMatcher.cs b/src/WireMock.Net/Matchers/JmesPathMatcher.cs index 83b88d19..884ba0ff 100644 --- a/src/WireMock.Net/Matchers/JmesPathMatcher.cs +++ b/src/WireMock.Net/Matchers/JmesPathMatcher.cs @@ -74,7 +74,7 @@ public class JmesPathMatcher : IStringMatcher, IObjectMatcher var score = MatchScores.Mismatch; Exception? exception = null; - if (input != null) + if (!string.IsNullOrWhiteSpace(input)) { try {