Skip to content

Commit f416ed7

Browse files
committed
fix: fix rootProtoManager.registerRootProto
not change the params order
1 parent 00a4848 commit f416ed7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

plugin/controller/lib/RootProtoManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export class RootProtoManager {
88
// <method, GetRootProtoCallback[]>
99
protoMap: Map<string, GetRootProtoCallback[]> = new Map();
1010

11-
registerRootProto(method: string, host: string, cb: GetRootProtoCallback) {
11+
registerRootProto(method: string, cb: GetRootProtoCallback, host: string) {
12+
host = host || '';
1213
const cbList = MapUtil.getOrStore(this.protoMap, method + host, []);
1314
cbList.push(cb);
1415
}

plugin/controller/lib/impl/http/HTTPMethodRegister.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ export class HTTPMethodRegister {
168168
const regExp = pathToRegexp(methodRealPath, {
169169
sensitive: true,
170170
});
171-
rootProtoManager.registerRootProto(this.methodMeta.method, host || '', (ctx: EggContext) => {
171+
rootProtoManager.registerRootProto(this.methodMeta.method, (ctx: EggContext) => {
172172
if (regExp.test(ctx.path)) {
173173
return this.proto;
174174
}
175-
});
175+
}, host || '');
176176
}
177177
}

0 commit comments

Comments
 (0)