Skip to content

Commit 7adc5e4

Browse files
committed
use lowercase for command matching
1 parent e46d416 commit 7adc5e4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/client/lib/cluster/request-response-policies/static-policy-resolver.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,22 @@ export class StaticPolicyResolver implements PolicyResolver {
2222
}
2323

2424
resolvePolicy(command: string): PolicyResult {
25-
const parts = command.split('.');
25+
const parts = command.toLowerCase().split('.');
26+
2627

2728
if (parts.length > 2) {
2829
return { ok: false, error: 'wrong-command-or-module-name' };
2930
}
3031

3132
const [moduleName, commandName] = parts.length === 1
32-
? ['std', command]
33+
? ['std', parts[0]]
3334
: parts;
3435

36+
console.log(`module name `, moduleName, `command name `, commandName);
37+
3538
if (!this.policies[moduleName]) {
3639
if (this.fallbackResolver) {
37-
return this.fallbackResolver.resolvePolicy(command);
40+
return this.fallbackResolver.resolvePolicy(commandName);
3841
}
3942

4043
// For std module commands, return 'unknown-command' instead of 'unknown-module'
@@ -48,7 +51,7 @@ export class StaticPolicyResolver implements PolicyResolver {
4851
if (!this.policies[moduleName][commandName]) {
4952
// Try fallback resolver if available
5053
if (this.fallbackResolver) {
51-
return this.fallbackResolver.resolvePolicy(command);
54+
return this.fallbackResolver.resolvePolicy(commandName);
5255
}
5356
return { ok: false, error: 'unknown-command' };
5457
}

0 commit comments

Comments
 (0)