summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-08-06 12:21:39 +0700
committerShulhan <ms@kilabit.info>2021-08-06 12:21:39 +0700
commitdb87fad8253df6aa3cbd5e047c3cd790539cad09 (patch)
tree8dbb7accd037fd420a551156055f24949b5a0f57
parent9d9016575a662a20018b8b89dc3e09eb8950d1a4 (diff)
downloadgorankusu-db87fad8253df6aa3cbd5e047c3cd790539cad09.tar.xz
all: add an handler ConvertParams to HttpTarget
The ConvertParams is a function that will be called inside the Run handler to convert the Params values to type that will be send as request.
-rw-r--r--http_target.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/http_target.go b/http_target.go
index 79057bb..bd8e910 100644
--- a/http_target.go
+++ b/http_target.go
@@ -16,6 +16,12 @@ import (
)
//
+// HttpConvertParams is a handler that will be called inside the Run handler
+// to convert the Params values to type that will be send as request.
+//
+type HttpConvertParams func(target *HttpTarget) (interface{}, error)
+
+//
// HttpRunHandler define the function type that will be called when client
// send request to run the HTTP target.
//
@@ -45,7 +51,9 @@ type HttpTarget struct {
Headers KeyValue
Params KeyValue
- Run HttpRunHandler `json:"-"`
+ Run HttpRunHandler `json:"-"`
+ ConvertParams HttpConvertParams `json:"-"`
+
Attack HttpAttackHandler `json:"-"`
PreAttack HttpPreAttackHandler `json:"-"`
AttackLocker sync.Mutex `json:"-"` // Use this inside the Attack to lock resource.