Skip to content

Commit

Permalink
fix: use a local variable instead of modifying config.url (#146)
Browse files Browse the repository at this point in the history
This keeps the url consistent with what axios outputs by default
  • Loading branch information
szdc authored and ctimmerm committed Jun 20, 2018
1 parent 9a29ced commit 8abf4a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/handle_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 8abf4a5

Please # to comment.