From e808d7dc21a6ff43451d71995951272245935e78 Mon Sep 17 00:00:00 2001 From: huangchaodian1 Date: Wed, 13 Oct 2021 11:45:26 +0800 Subject: [PATCH 1/2] fix: rm url param when find handler --- src/handle_request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/handle_request.js b/src/handle_request.js index dc84f3c..5bfa4b1 100644 --- a/src/handle_request.js +++ b/src/handle_request.js @@ -49,7 +49,7 @@ function handleRequest(mockAdapter, resolve, reject, config) { var handler = utils.findHandler( mockAdapter.handlers, config.method, - url, + url.substring(0,url.indexOf("?")), config.data, config.params, config.headers, From 2c277a2af3eb595bed6ce83318f1f99f3952d62d Mon Sep 17 00:00:00 2001 From: huangchaodian1 Date: Wed, 13 Oct 2021 14:06:32 +0800 Subject: [PATCH 2/2] fix: rm url params --- src/handle_request.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/handle_request.js b/src/handle_request.js index 5bfa4b1..9315559 100644 --- a/src/handle_request.js +++ b/src/handle_request.js @@ -43,13 +43,17 @@ function handleRequest(mockAdapter, resolve, reject, config) { url = url.slice(config.baseURL.length); } + if (url.indexOf("?") !== -1) { + url = url.substring(0, url.indexOf("?")) + } + delete config.adapter; mockAdapter.history[config.method].push(config); var handler = utils.findHandler( mockAdapter.handlers, config.method, - url.substring(0,url.indexOf("?")), + url, config.data, config.params, config.headers,