mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 06:19:34 +08:00
fix: error of concurrent map writes occurred while uploading in boom mode
This commit is contained in:
@@ -9,12 +9,13 @@ import (
|
||||
func TestCaseUploadFile(t *testing.T) {
|
||||
testcase := &hrp.TestCase{
|
||||
Config: hrp.NewConfig("test upload file to httpbin").
|
||||
SetBaseURL("https://httpbin.org"),
|
||||
SetBaseURL("https://httpbin.org").
|
||||
WithVariables(map[string]interface{}{"upload_file": "test.env"}),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("upload file").
|
||||
WithVariables(map[string]interface{}{
|
||||
"m_encoder": "${multipart_encoder($m_upload)}",
|
||||
"m_upload": map[string]interface{}{"file": "test.env"},
|
||||
"m_upload": map[string]interface{}{"file": "$upload_file"},
|
||||
}).
|
||||
POST("/post").
|
||||
WithHeaders(map[string]string{"Content-Type": "${multipart_content_type($m_encoder)}"}).
|
||||
@@ -24,7 +25,7 @@ func TestCaseUploadFile(t *testing.T) {
|
||||
AssertStartsWith("body.files.file", "UserName=test", "check uploaded file"),
|
||||
hrp.NewStep("upload file with keyword").
|
||||
POST("/post").
|
||||
WithUpload(map[string]interface{}{"file": "test.env"}).
|
||||
WithUpload(map[string]interface{}{"file": "$upload_file"}).
|
||||
Validate().
|
||||
AssertEqual("status_code", 200, "check status code").
|
||||
AssertStartsWith("body.files.file", "UserName=test", "check uploaded file"),
|
||||
|
||||
Reference in New Issue
Block a user