mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-30 12:59:39 +08:00
fix: add slice type of request body data
This commit is contained in:
10
runner.go
10
runner.go
@@ -716,6 +716,16 @@ func (r *caseRunner) runStepRequest(step *TStep) (stepResult *stepData, err erro
|
||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||
}
|
||||
}
|
||||
case []interface{}:
|
||||
contentType := req.Header.Get("Content-Type")
|
||||
// post json
|
||||
dataBytes, err = json.Marshal(vv)
|
||||
if err != nil {
|
||||
return stepResult, err
|
||||
}
|
||||
if contentType == "" {
|
||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||
}
|
||||
case string:
|
||||
dataBytes = []byte(vv)
|
||||
case []byte:
|
||||
|
||||
Reference in New Issue
Block a user