From 7fed1f75a32c161ba0d296dbb7b6dc14e831336e Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 21 Mar 2021 23:24:46 +0700 Subject: all: implement interface and API to cancel running attack On the top of the page, it will display currently running attack with target name and HTTP target name. User can cancel the attack by clicking "Cancel" button on the right. --- errors.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'errors.go') diff --git a/errors.go b/errors.go index 29dcfee..f5f04b4 100644 --- a/errors.go +++ b/errors.go @@ -12,14 +12,15 @@ import ( libhttp "github.com/shuLhan/share/lib/http" ) -func errAttackConflict(ar *AttackResult) error { +func errAttackConflict(rr *RunRequest) error { res := &libhttp.EndpointResponse{ E: liberrors.E{ - Code: http.StatusConflict, - Message: "another attack is already running", - Name: "ERR_ATTACK_CONFLICT", + Code: http.StatusConflict, + Message: fmt.Sprintf(`Another attack is already running: "%s/%s`, + rr.Target.Name, rr.HttpTarget.Name), + Name: "ERR_ATTACK_CONFLICT", }, - Data: ar, + Data: rr, } return res } -- cgit v1.3-5-g9baa