mock-service-cli 3.3.5 → 3.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/mockServer.js CHANGED
@@ -19,7 +19,7 @@ const {
19
19
  } = require('./utils');
20
20
  const { genMockFiles, getMockStatFromDir, getMockStatFromFile } = require('./manageMockFiles');
21
21
 
22
- const methodRegExp = new RegExp(`(${SupportMethods.join('|')}) +(.*)`, 'i');
22
+ const methodRegExp = new RegExp(`((${SupportMethods.join('|')}) +)?([^?]*)`, 'i');
23
23
 
24
24
  const app = express();
25
25
  const log = logger(process.env.SILENT);
@@ -138,11 +138,11 @@ function composeRouteFromJsFile(file) {
138
138
  let reqMethod = 'get',
139
139
  reqUrl = item;
140
140
  // 支持(GET|POST|PUT|DELETE|HEAD|PATCH|OPTIONS|COPY|LINK|UNLINK|PURGE)常用方法, 默认GET请求
141
- if (methodRegExp.exec(item)) {
142
- const [, method, url] = methodRegExp.exec(item);
141
+ const [, , method, url] = methodRegExp.exec(item);
142
+ if (method) {
143
143
  reqMethod = method.toLowerCase();
144
- reqUrl = url;
145
144
  }
145
+ reqUrl = url;
146
146
  argv.a &&
147
147
  log.info(
148
148
  colors.grey(`path ${String(++count).padStart(3, ' ')}: `),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mock-service-cli",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "🦅 Local Mock/Static/SPA server, Http?s request proxy",
5
5
  "main": "./lib/mockServer.js",
6
6
  "bin": {