From 4bf3c12f75d140734559acd3d2fcbe6bdc47331a Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 25 Sep 2021 02:53:34 +0700 Subject: all: check and convert HTTP target parameters to multipart/form-data If the content-type of request is multipart/form-data, convert the parameters in HttpTarget using ToMultipartFormData(). --- trunks.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trunks.go b/trunks.go index 2972b54..4b61009 100644 --- a/trunks.go +++ b/trunks.go @@ -512,9 +512,12 @@ func (trunks *Trunks) runHttpTarget(rr *RunRequest) (res *RunResponse, err error params interface{} ) - if rr.HttpTarget.RequestType == libhttp.RequestTypeJSON { + switch rr.HttpTarget.RequestType { + case libhttp.RequestTypeJSON: params = rr.HttpTarget.Params.ToJsonObject() - } else { + case libhttp.RequestTypeMultipartForm: + params = rr.HttpTarget.Params.ToMultipartFormData() + default: params = rr.HttpTarget.Params.ToUrlValues() } -- cgit v1.3