mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: check empty upload
This commit is contained in:
@@ -2,6 +2,7 @@ package hrp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
@@ -126,7 +127,7 @@ func extendWithAPI(testStep *TStep, overriddenStep *API) {
|
||||
// merge & override request
|
||||
testStep.Request = overriddenStep.Request
|
||||
// init upload
|
||||
if testStep.Request.Upload != nil {
|
||||
if len(testStep.Request.Upload) != 0 {
|
||||
initUpload(testStep)
|
||||
}
|
||||
// merge & override variables
|
||||
|
||||
@@ -268,7 +268,7 @@ func initUpload(step *TStep) {
|
||||
}
|
||||
|
||||
func prepareUpload(parser *Parser, step *TStep, stepVariables map[string]interface{}) (err error) {
|
||||
if step.Request.Upload == nil {
|
||||
if len(step.Request.Upload) == 0 {
|
||||
return
|
||||
}
|
||||
uploadMap, err := parser.Parse(step.Request.Upload, stepVariables)
|
||||
|
||||
@@ -148,7 +148,7 @@ func (path *TestCasePath) ToTestCase() (*TestCase, error) {
|
||||
})
|
||||
} else if step.Request != nil {
|
||||
// init upload
|
||||
if step.Request.Upload != nil {
|
||||
if len(step.Request.Upload) != 0 {
|
||||
initUpload(step)
|
||||
}
|
||||
testCase.TestSteps = append(testCase.TestSteps, &StepRequestWithOptionalArgs{
|
||||
|
||||
Reference in New Issue
Block a user