fix: mock.js request method match

This commit is contained in:
username 2026-01-21 18:51:53 +08:00
parent 6ae0b0a75c
commit 4154a42f72

View File

@ -137,7 +137,7 @@ export default (api) => {
return next();
}
// 请求以 cgiMock.prefix 开头,匹配处理
const matchRequet = requestList.find((item) => req.path.search(item.url) !== -1 && req.method === (item.method || 'GET').toUpperCase());
const matchRequet = requestList.find((item) => req.path.search(item.url) !== -1 && (item.method ? req.method === item.method.toUpperCase() : true));
if (!matchRequet) {
return next();
}