Moved OK and WRON_ARGS_RESPONSE to utils const file

This commit is contained in:
Kelvin Clement Mwinuka
2023-12-15 20:04:02 +08:00
parent 5db0164335
commit e6a107f78b
9 changed files with 89 additions and 97 deletions

View File

@@ -64,12 +64,12 @@ func (p Plugin) HandleCommand(ctx context.Context, cmd []string, server utils.Se
func (p Plugin) handleAuth(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd) < 2 || len(cmd) > 3 {
return nil, errors.New("wrong number of arguments")
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
}
if err := p.acl.AuthenticateConnection(conn, cmd); err != nil {
return nil, err
}
return []byte("+OK\r\n\n"), nil
return []byte(utils.OK_RESPONSE), nil
}
func (p Plugin) handleGetUser(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {