From 0820f2234c014bb205e1e7cb405e0ad014b7ff12 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Tue, 16 May 2023 12:48:55 +0700 Subject: all: fix panic when attacking HTTP due to nil Attack handler In attack endpoint, check if the Attack is nil before we push the request to attack queue. --- errors.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'errors.go') diff --git a/errors.go b/errors.go index 7f08980..2da10e6 100644 --- a/errors.go +++ b/errors.go @@ -35,6 +35,14 @@ func errAttackNotAllowed() error { return res } +var errAttackHandlerNotSet = libhttp.EndpointResponse{ + E: liberrors.E{ + Code: http.StatusNotAcceptable, + Message: `the Attack handler is not set`, + Name: `ERR_ATTACK_HANDLER_NOT_SET`, + }, +} + func errInternal(err error) error { res := &libhttp.EndpointResponse{ E: liberrors.E{ -- cgit v1.3