From 8abf4a5a30e7922027a596b4ca9a2b5f2d1f18dc Mon Sep 17 00:00:00 2001 From: Jack Willis-Craig Date: Wed, 20 Jun 2018 16:22:05 +1000 Subject: [PATCH] fix: use a local variable instead of modifying config.url (#146) This keeps the url consistent with what axios outputs by default --- src/handle_request.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/handle_request.js b/src/handle_request.js index c5ae465..7a8b077 100644 --- a/src/handle_request.js +++ b/src/handle_request.js @@ -12,8 +12,9 @@ function makeResponse(result, config) { } function handleRequest(mockAdapter, resolve, reject, config) { + var url = config.url; if (config.baseURL && config.url.substr(0, config.baseURL.length) === config.baseURL) { - config.url = config.url.slice(config.baseURL ? config.baseURL.length : 0); + url = config.url.slice(config.baseURL ? config.baseURL.length : 0); } delete config.adapter; @@ -22,7 +23,7 @@ function handleRequest(mockAdapter, resolve, reject, config) { var handler = utils.findHandler( mockAdapter.handlers, config.method, - config.url, + url, config.data, config.params, config.headers,