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