MCPcopy
hub / github.com/youzan/zan-proxy / test

Method test

src/core/manager/controller/rule.ts:84–103  ·  view source on GitHub ↗
(@Ctx() ctx: Context)

Source from the content-addressed store, hash-verified

82 // 测试规则
83 @Post('/test')
84 public async test(@Ctx() ctx: Context) {
85 const {
86 request: { body },
87 } = ctx;
88 const { match, url, targetTpl } = body as IRuleTest;
89
90 if (match && (url.indexOf(match) >= 0 || new RegExp(match).test(url))) {
91 const targetRlt = this.profileService.calcPath(url, match, targetTpl);
92 // 测试规则
93 return {
94 matchRlt: 'url匹配通过',
95 targetRlt,
96 };
97 }
98
99 return {
100 matchRlt: '不匹配',
101 targetRlt: '',
102 };
103 }
104
105 @Post('/import')
106 public async import(@Ctx() ctx: Context) {

Callers 15

resolveHostMethod · 0.80
isMatchUrlMethod · 0.80
oFunction · 0.80
pFunction · 0.80
bFunction · 0.80
SFunction · 0.80
AFunction · 0.80
DFunction · 0.80
PFunction · 0.80
WFunction · 0.80
KFunction · 0.80
QFunction · 0.80

Calls 1

calcPathMethod · 0.80

Tested by

no test coverage detected