From db87fad8253df6aa3cbd5e047c3cd790539cad09 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 6 Aug 2021 12:21:39 +0700 Subject: 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. --- http_target.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/http_target.go b/http_target.go index 79057bb..bd8e910 100644 --- a/http_target.go +++ b/http_target.go @@ -15,6 +15,12 @@ import ( vegeta "github.com/tsenart/vegeta/v12/lib" ) +// +// 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. -- cgit v1.3