From 59b309da07d311441c8adbe4c1243f6acac2a9b2 Mon Sep 17 00:00:00 2001 From: up1 Date: Thu, 9 Feb 2023 13:00:46 +0700 Subject: [PATCH] Try to compare with JSON Parser between request.post and post data from JSON file --- src/models/endpoint.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/models/endpoint.js b/src/models/endpoint.js index d40b7b0..f3b7a40 100644 --- a/src/models/endpoint.js +++ b/src/models/endpoint.js @@ -41,7 +41,16 @@ class Endpoint { const post = file || this.request.post; if (post && request.post) { matches.post = matchRegex(normalizeEOL(post), normalizeEOL(request.post)); - if (!matches.post) { return null; } + if (!matches.post) { + // Try to compare with JSON format + try { + const jsonRequest = JSON.parse(request.post); + const jsonPostRequest = JSON.parse(post); + if (!compareObjects(jsonRequest, jsonPostRequest)) { return null; } + } catch (e) { + return null; + } + } } else if (this.request.json && request.post) { try { json = JSON.parse(request.post);