diff options
| author | Shulhan <ms@kilabit.info> | 2021-09-25 02:53:34 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-09-25 02:53:34 +0700 |
| commit | 4bf3c12f75d140734559acd3d2fcbe6bdc47331a (patch) | |
| tree | 06cbc438f93e3f9cdbc5c7fca522e7ed022860b8 | |
| parent | 66975f1b439dcbb185b9b7c2d6ca382606cc23d2 (diff) | |
| download | gorankusu-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().
| -rw-r--r-- | trunks.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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() } |
