Skip to content

Commit cb77477

Browse files
committed
fix integration tests - validate args first
1 parent 7d101ba commit cb77477

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

miniredis.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,16 @@ func exactly(n int) argRequirements {
485485

486486
// isValidCMD returns true if command is valid and can be executed.
487487
func (m *Miniredis) isValidCMD(c *server.Peer, cmd string, args []string, argReqs argRequirements) bool {
488-
if !m.handleAuth(c) {
488+
if len(args) < argReqs.minimum || (argReqs.maximum != nil && len(args) > *argReqs.maximum) {
489+
setDirty(c)
490+
c.WriteError(errWrongNumber(cmd))
489491
return false
490492
}
491-
if m.checkPubsub(c, cmd) {
493+
494+
if !m.handleAuth(c) {
492495
return false
493496
}
494-
495-
if len(args) < argReqs.minimum || (argReqs.maximum != nil && len(args) > *argReqs.maximum) {
496-
setDirty(c)
497-
c.WriteError(errWrongNumber(cmd))
497+
if m.checkPubsub(c, cmd) {
498498
return false
499499
}
500500

0 commit comments

Comments
 (0)