Skip to content

Commit 863fb71

Browse files
committed
rename variables
1 parent 9693ac5 commit 863fb71

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/createMockMiddleware.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,14 @@ export default function getMockMiddleware(mockDir, options) {
135135
}
136136

137137
function matchMock(req) {
138-
const { path: exceptPath } = req;
139-
const exceptMethod = req.method.toLowerCase();
138+
const targetPath = req.path;
139+
const targetMethod = req.method.toLowerCase();
140+
// debug(`${targetMethod} ${targetPath}`);
140141

141142
for (const mock of mockData) {
142143
const { method, re, keys } = mock;
143-
if (method === exceptMethod) {
144-
const match = re.exec(req.path);
144+
if (method === targetMethod) {
145+
const match = re.exec(targetPath);
145146
if (match) {
146147
const params = {};
147148

@@ -179,7 +180,7 @@ export default function getMockMiddleware(mockDir, options) {
179180
}
180181

181182
return mockData.filter(({ method, re }) => {
182-
return method === exceptMethod && re.test(exceptPath);
183+
return method === targetMethod && re.test(targetPath);
183184
})[0];
184185
}
185186

0 commit comments

Comments
 (0)