aboutsummaryrefslogtreecommitdiff
path: root/trunks.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-09-25 02:53:34 +0700
committerShulhan <ms@kilabit.info>2021-09-25 02:53:34 +0700
commit4bf3c12f75d140734559acd3d2fcbe6bdc47331a (patch)
tree06cbc438f93e3f9cdbc5c7fca522e7ed022860b8 /trunks.go
parent66975f1b439dcbb185b9b7c2d6ca382606cc23d2 (diff)
downloadgorankusu-4bf3c12f75d140734559acd3d2fcbe6bdc47331a.tar.xz
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().
Diffstat (limited to 'trunks.go')
-rw-r--r--trunks.go7
1 files 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()
}