Skip to content

Commit

Permalink
fix: empty TS file in mock folder is error
Browse files Browse the repository at this point in the history
  • Loading branch information
张益铭 committed Mar 29, 2021
1 parent 6eb756d commit 669b804
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/createMockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export async function requestMiddle(opt: ViteMockOptions) {

const reqUrl = isGet ? queryParams.pathname : req.url;
const matchReq = mockData.find((item) => {
if (!item.url) return;
if (item.method && item.method.toUpperCase() !== req.method) return false;
if (!reqUrl) return false;
return pathToRegexp(item.url).test(reqUrl);
Expand Down

0 comments on commit 669b804

Please sign in to comment.