From 14dc566eeaaeb4b68ca58f9cb2703e99f5c59d13 Mon Sep 17 00:00:00 2001 From: xucong053 Date: Thu, 30 Jun 2022 21:00:38 +0800 Subject: [PATCH 1/5] fix: step name with parameterize mechanism --- examples/hrp/parameters_test.json | 2 +- examples/hrp/parameters_test.yaml | 2 +- hrp/boomer.go | 11 +++++++++-- hrp/session.go | 9 ++++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/examples/hrp/parameters_test.json b/examples/hrp/parameters_test.json index 4af949ed..1763d755 100644 --- a/examples/hrp/parameters_test.json +++ b/examples/hrp/parameters_test.json @@ -31,7 +31,7 @@ }, "teststeps": [ { - "name": "get with params", + "name": "get with user: $username", "variables": { "foo1": "$username", "foo2": "$password", diff --git a/examples/hrp/parameters_test.yaml b/examples/hrp/parameters_test.yaml index 23fd8c01..b431d4b3 100644 --- a/examples/hrp/parameters_test.yaml +++ b/examples/hrp/parameters_test.yaml @@ -20,7 +20,7 @@ config: verify: False teststeps: - - name: get with params + - name: "get with user: $username" variables: foo1: $username foo2: $password diff --git a/hrp/boomer.go b/hrp/boomer.go index 839ebd15..fddc47df 100644 --- a/hrp/boomer.go +++ b/hrp/boomer.go @@ -125,18 +125,25 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend startTime := time.Now() for _, step := range testcase.TestSteps { + // parse step name + parsedName, err := sessionRunner.parser.ParseString(step.Name(), sessionRunner.sessionVariables) + if err != nil { + parsedName = step.Name() + } + stepName := convertString(parsedName) // reset start time only once before step once.Do(func() { b.Boomer.ResetStartTime() }) stepResult, err := step.Run(sessionRunner) + stepResult.Name = stepName if err != nil { // step failed var elapsed int64 if stepResult != nil { elapsed = stepResult.Elapsed } - b.RecordFailure(string(step.Type()), step.Name(), elapsed, err.Error()) + b.RecordFailure(string(step.Type()), stepResult.Name, elapsed, err.Error()) // update flag testcaseSuccess = false @@ -165,7 +172,7 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend // no record required } else { // request or testcase step - b.RecordSuccess(string(step.Type()), step.Name(), stepResult.Elapsed, stepResult.ContentSize) + b.RecordSuccess(string(step.Type()), stepResult.Name, stepResult.Elapsed, stepResult.ContentSize) // update extracted variables for k, v := range stepResult.ExportVars { sessionRunner.sessionVariables[k] = v diff --git a/hrp/session.go b/hrp/session.go index eae3b41a..6a57de06 100644 --- a/hrp/session.go +++ b/hrp/session.go @@ -64,10 +64,17 @@ func (r *SessionRunner) Start(givenVars map[string]interface{}) error { // run step in sequential order for _, step := range r.testCase.TestSteps { - log.Info().Str("step", step.Name()). + // parse step name + parsedName, err := r.parser.ParseString(step.Name(), r.sessionVariables) + if err != nil { + parsedName = step.Name() + } + stepName := convertString(parsedName) + log.Info().Str("step", stepName). Str("type", string(step.Type())).Msg("run step start") stepResult, err := step.Run(r) + stepResult.Name = stepName if err != nil { log.Error(). Str("step", stepResult.Name). From ee8cfcae862f9ea38e54834932e5a568ca7aaf54 Mon Sep 17 00:00:00 2001 From: xucong053 Date: Thu, 30 Jun 2022 23:29:16 +0800 Subject: [PATCH 2/5] fix: error of concurrent map writes occurred while uploading in boom mode --- hrp/step_api.go | 4 ++++ hrp/step_request.go | 41 ++++++++++++++++++++++++---------------- hrp/testcase.go | 4 ++++ hrp/tests/upload_test.go | 7 ++++--- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/hrp/step_api.go b/hrp/step_api.go index cce14cd0..a2c0bad0 100644 --- a/hrp/step_api.go +++ b/hrp/step_api.go @@ -117,6 +117,10 @@ func extendWithAPI(testStep *TStep, overriddenStep *API) { } // merge & override request testStep.Request = overriddenStep.Request + // init upload + if testStep.Request.Upload != nil { + initUpload(testStep) + } // merge & override variables testStep.Variables = mergeVariables(testStep.Variables, overriddenStep.Variables) // merge & override extractors diff --git a/hrp/step_request.go b/hrp/step_request.go index 29a86578..a854af19 100644 --- a/hrp/step_request.go +++ b/hrp/step_request.go @@ -259,24 +259,31 @@ func (r *requestBuilder) prepareBody(stepVariables map[string]interface{}) error return nil } -func prepareUpload(parser *Parser, step *TStep) (err error) { - if step.Request.Upload == nil { - return - } - step.Request.Upload, err = parser.ParseVariables(step.Request.Upload) - if err != nil { - return - } - if step.Variables == nil { - step.Variables = make(map[string]interface{}) - } - step.Variables["m_upload"] = step.Request.Upload - step.Variables["m_encoder"] = fmt.Sprintf("${multipart_encoder($m_upload)}") +func initUpload(step *TStep) { if step.Request.Headers == nil { step.Request.Headers = make(map[string]string) } step.Request.Headers["Content-Type"] = "${multipart_content_type($m_encoder)}" step.Request.Body = "$m_encoder" +} + +func prepareUpload(parser *Parser, step *TStep, stepVariables map[string]interface{}) (err error) { + if step.Request.Upload == nil { + return + } + uploadSlice := map[string]interface{}{} + for key, value := range step.Request.Upload { + uploadSlice[key], err = parser.Parse(value, stepVariables) + if err != nil { + return + } + } + stepVariables["m_upload"] = uploadSlice + mEncoder, err := parser.Parse("${multipart_encoder($m_upload)}", stepVariables) + if err != nil { + return + } + stepVariables["m_encoder"] = mEncoder return } @@ -295,13 +302,13 @@ func runStepRequest(r *SessionRunner, step *TStep) (stepResult *StepResult, err } }() - err = prepareUpload(r.parser, step) + // override step variables + stepVariables, err := r.MergeStepVariables(step.Variables) if err != nil { return } - // override step variables - stepVariables, err := r.MergeStepVariables(step.Variables) + err = prepareUpload(r.parser, step, stepVariables) if err != nil { return } @@ -822,6 +829,8 @@ func (s *StepRequestWithOptionalArgs) WithBody(body interface{}) *StepRequestWit // WithUpload sets HTTP request body for uploading file(s). func (s *StepRequestWithOptionalArgs) WithUpload(upload map[string]interface{}) *StepRequestWithOptionalArgs { + // init upload + initUpload(s.step) s.step.Request.Upload = upload return s } diff --git a/hrp/testcase.go b/hrp/testcase.go index 6a91939b..69120497 100644 --- a/hrp/testcase.go +++ b/hrp/testcase.go @@ -144,6 +144,10 @@ func (path *TestCasePath) ToTestCase() (*TestCase, error) { step: step, }) } else if step.Request != nil { + // init upload + if step.Request.Upload != nil { + initUpload(step) + } testCase.TestSteps = append(testCase.TestSteps, &StepRequestWithOptionalArgs{ step: step, }) diff --git a/hrp/tests/upload_test.go b/hrp/tests/upload_test.go index d9273d17..2897eabe 100644 --- a/hrp/tests/upload_test.go +++ b/hrp/tests/upload_test.go @@ -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"), From 6a40da46e0168ca5d5be0dfebb5888c145c2d1a4 Mon Sep 17 00:00:00 2001 From: xucong053 Date: Fri, 1 Jul 2022 11:53:27 +0800 Subject: [PATCH 3/5] fix: record all requests of testcase reference in boom mode --- examples/demo-with-py-plugin/.debugtalk_gen.py | 2 +- hrp/boomer.go | 15 ++++++++++++++- hrp/internal/boomer/stats.go | 8 ++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/demo-with-py-plugin/.debugtalk_gen.py b/examples/demo-with-py-plugin/.debugtalk_gen.py index a57fef72..70910180 100644 --- a/examples/demo-with-py-plugin/.debugtalk_gen.py +++ b/examples/demo-with-py-plugin/.debugtalk_gen.py @@ -1,4 +1,4 @@ -# NOTE: Generated By hrp v4.1.4, DO NOT EDIT! +# NOTE: Generated By hrp v4.1.5, DO NOT EDIT! import sys import os diff --git a/hrp/boomer.go b/hrp/boomer.go index fddc47df..4c2bcebe 100644 --- a/hrp/boomer.go +++ b/hrp/boomer.go @@ -136,7 +136,20 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend b.Boomer.ResetStartTime() }) stepResult, err := step.Run(sessionRunner) + // update step result name with parsed step name stepResult.Name = stepName + // record requests result of the step if step type is testcase + if stepResult.StepType == stepTypeTestCase && stepResult.Data != nil { + // record requests of testcase step + for _, result := range stepResult.Data.([]*StepResult) { + if result.Success { + b.RecordSuccess(string(result.StepType), result.Name, result.Elapsed, result.ContentSize) + } else { + b.RecordFailure(string(result.StepType), result.Name, result.Elapsed, result.Attachment) + } + } + } + // record step failure if err != nil { // step failed var elapsed int64 @@ -157,7 +170,7 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend continue } - // step success + // record step success if stepResult.StepType == stepTypeTransaction { // transaction // FIXME: support nested transactions diff --git a/hrp/internal/boomer/stats.go b/hrp/internal/boomer/stats.go index c1bbcfe8..043246cb 100644 --- a/hrp/internal/boomer/stats.go +++ b/hrp/internal/boomer/stats.go @@ -74,12 +74,16 @@ func (s *requestStats) logTransaction(name string, success bool, responseTime in } func (s *requestStats) logRequest(method, name string, responseTime int64, contentLength int64) { - s.total.log(responseTime, contentLength) + if method != "testcase" { + s.total.log(responseTime, contentLength) + } s.get(name, method).log(responseTime, contentLength) } func (s *requestStats) logError(method, name, err string) { - s.total.logFailures() + if method != "testcase" { + s.total.logFailures() + } s.get(name, method).logFailures() // store error in errors map From fac75e2be36b31b47d5bc7230e76147e272669c3 Mon Sep 17 00:00:00 2001 From: xucong053 Date: Fri, 1 Jul 2022 16:41:33 +0800 Subject: [PATCH 4/5] fix: failed to record the step of occuring error in the html report --- hrp/step_request.go | 21 ++++++++++----------- hrp/step_testcase.go | 22 +++++++++++++--------- hrp/step_websocket.go | 20 ++++++++++---------- hrp/summary.go | 1 + 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/hrp/step_request.go b/hrp/step_request.go index a854af19..8603bf1e 100644 --- a/hrp/step_request.go +++ b/hrp/step_request.go @@ -300,6 +300,16 @@ func runStepRequest(r *SessionRunner, step *TStep) (stepResult *StepResult, err if err != nil { stepResult.Attachment = err.Error() } + // update summary + r.summary.Records = append(r.summary.Records, stepResult) + r.summary.Stat.Total += 1 + if stepResult.Success { + r.summary.Stat.Successes += 1 + } else { + r.summary.Stat.Failures += 1 + // update summary result to failed + r.summary.Success = false + } }() // override step variables @@ -442,17 +452,6 @@ func runStepRequest(r *SessionRunner, step *TStep) (stepResult *StepResult, err stepResult.ContentSize = resp.ContentLength stepResult.Data = sessionData - // update summary - r.summary.Records = append(r.summary.Records, stepResult) - r.summary.Stat.Total += 1 - if stepResult.Success { - r.summary.Stat.Successes += 1 - } else { - r.summary.Stat.Failures += 1 - // update summary result to failed - r.summary.Success = false - } - return stepResult, err } diff --git a/hrp/step_testcase.go b/hrp/step_testcase.go index e75e52e4..09440e5a 100644 --- a/hrp/step_testcase.go +++ b/hrp/step_testcase.go @@ -44,13 +44,20 @@ func (s *StepTestCaseWithOptionalArgs) Struct() *TStep { return s.step } -func (s *StepTestCaseWithOptionalArgs) Run(r *SessionRunner) (*StepResult, error) { - stepResult := &StepResult{ +func (s *StepTestCaseWithOptionalArgs) Run(r *SessionRunner) (stepResult *StepResult, err error) { + stepResult = &StepResult{ Name: s.step.Name, StepType: stepTypeTestCase, Success: false, } + defer func() { + // update testcase summary + if err != nil { + stepResult.Attachment = err.Error() + } + }() + stepVariables, err := r.MergeStepVariables(s.step.Variables) if err != nil { return stepResult, err @@ -82,12 +89,10 @@ func (s *StepTestCaseWithOptionalArgs) Run(r *SessionRunner) (*StepResult, error start := time.Now() // run referenced testcase with step variables err = sessionRunner.Start(stepVariables) - stepResult.Elapsed = time.Since(start).Milliseconds() - if err != nil { - stepResult.Attachment = err.Error() - r.summary.Success = false - return stepResult, err + if err == nil { + stepResult.Success = true } + stepResult.Elapsed = time.Since(start).Milliseconds() summary := sessionRunner.GetSummary() // update step names for _, record := range summary.Records { @@ -96,7 +101,6 @@ func (s *StepTestCaseWithOptionalArgs) Run(r *SessionRunner) (*StepResult, error stepResult.Data = summary.Records // export testcase export variables stepResult.ExportVars = summary.InOut.ExportVars - stepResult.Success = true // merge testcase summary r.summary.Records = append(r.summary.Records, summary.Records...) @@ -104,5 +108,5 @@ func (s *StepTestCaseWithOptionalArgs) Run(r *SessionRunner) (*StepResult, error r.summary.Stat.Successes += summary.Stat.Successes r.summary.Stat.Failures += summary.Stat.Failures - return stepResult, nil + return stepResult, err } diff --git a/hrp/step_websocket.go b/hrp/step_websocket.go index 34cc226c..0967be1f 100644 --- a/hrp/step_websocket.go +++ b/hrp/step_websocket.go @@ -239,6 +239,16 @@ func runStepWebSocket(r *SessionRunner, step *TStep) (stepResult *StepResult, er if err != nil { stepResult.Attachment = err.Error() } + // update summary + r.summary.Records = append(r.summary.Records, stepResult) + r.summary.Stat.Total += 1 + if stepResult.Success { + r.summary.Stat.Successes += 1 + } else { + r.summary.Stat.Failures += 1 + // update summary result to failed + r.summary.Success = false + } }() // override step variables @@ -385,16 +395,6 @@ func runStepWebSocket(r *SessionRunner, step *TStep) (stepResult *StepResult, er stepResult.Success = true } - // update summary - r.summary.Records = append(r.summary.Records, stepResult) - r.summary.Stat.Total += 1 - if stepResult.Success { - r.summary.Stat.Successes += 1 - } else { - r.summary.Stat.Failures += 1 - // update summary result to failed - r.summary.Success = false - } return stepResult, nil } diff --git a/hrp/summary.go b/hrp/summary.go index 13e6085a..b73522cc 100644 --- a/hrp/summary.go +++ b/hrp/summary.go @@ -199,5 +199,6 @@ func newSummary() *TestCaseSummary { Stat: &TestStepStat{}, Time: &TestCaseTime{}, InOut: &TestCaseInOut{}, + Records: []*StepResult{}, } } From f1898629ed459bff48bd4299be974b93c56292da Mon Sep 17 00:00:00 2001 From: xucong053 Date: Mon, 4 Jul 2022 14:59:02 +0800 Subject: [PATCH 5/5] change: update docs --- docs/CHANGELOG.md | 9 +++++++++ docs/cmd/hrp.md | 2 +- docs/cmd/hrp_boom.md | 2 +- docs/cmd/hrp_build.md | 2 +- docs/cmd/hrp_convert.md | 2 +- docs/cmd/hrp_pytest.md | 2 +- docs/cmd/hrp_run.md | 2 +- docs/cmd/hrp_startproject.md | 2 +- docs/cmd/hrp_wiki.md | 2 +- examples/demo-empty-project/proj.json | 4 ++-- examples/demo-with-go-plugin/proj.json | 4 ++-- examples/demo-with-py-plugin/proj.json | 4 ++-- examples/demo-without-plugin/proj.json | 4 ++-- .../scaffold/templates/plugin/.debugtalk_gen.py | 2 +- .../scaffold/templates/plugin/debugtalk_gen.go | 2 +- hrp/step_request.go | 11 ++++------- 16 files changed, 31 insertions(+), 25 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 74bef791..f72658df 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,14 @@ # Release History +## v4.1.6 (2022-07-04) + +**go version** + +- fix: step name with parameterize mechanism +- fix: error of concurrent map writes occurred while uploading in boom mode +- fix: record all requests of testcase reference in boom mode +- fix: failed to record the step of occurring error in the html report + ## v4.1.5 (2022-06-27) **go version** diff --git a/docs/cmd/hrp.md b/docs/cmd/hrp.md index 4273be35..7dc86997 100644 --- a/docs/cmd/hrp.md +++ b/docs/cmd/hrp.md @@ -37,4 +37,4 @@ Copyright 2017 debugtalk * [hrp startproject](hrp_startproject.md) - create a scaffold project * [hrp wiki](hrp_wiki.md) - visit https://httprunner.com -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/docs/cmd/hrp_boom.md b/docs/cmd/hrp_boom.md index 40cd994d..7354315a 100644 --- a/docs/cmd/hrp_boom.md +++ b/docs/cmd/hrp_boom.md @@ -42,4 +42,4 @@ hrp boom [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/docs/cmd/hrp_build.md b/docs/cmd/hrp_build.md index d8b6c97b..8103dbbd 100644 --- a/docs/cmd/hrp_build.md +++ b/docs/cmd/hrp_build.md @@ -28,4 +28,4 @@ hrp build $path ... [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/docs/cmd/hrp_convert.md b/docs/cmd/hrp_convert.md index 75684067..d438da68 100644 --- a/docs/cmd/hrp_convert.md +++ b/docs/cmd/hrp_convert.md @@ -22,4 +22,4 @@ hrp convert $path... [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/docs/cmd/hrp_pytest.md b/docs/cmd/hrp_pytest.md index 5c70465b..fc51e272 100644 --- a/docs/cmd/hrp_pytest.md +++ b/docs/cmd/hrp_pytest.md @@ -16,4 +16,4 @@ hrp pytest $path ... [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/docs/cmd/hrp_run.md b/docs/cmd/hrp_run.md index 3b93507e..428e6984 100644 --- a/docs/cmd/hrp_run.md +++ b/docs/cmd/hrp_run.md @@ -35,4 +35,4 @@ hrp run $path... [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/docs/cmd/hrp_startproject.md b/docs/cmd/hrp_startproject.md index acfcb432..49544063 100644 --- a/docs/cmd/hrp_startproject.md +++ b/docs/cmd/hrp_startproject.md @@ -21,4 +21,4 @@ hrp startproject $project_name [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/docs/cmd/hrp_wiki.md b/docs/cmd/hrp_wiki.md index 7614dbe6..219920fe 100644 --- a/docs/cmd/hrp_wiki.md +++ b/docs/cmd/hrp_wiki.md @@ -16,4 +16,4 @@ hrp wiki [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 27-Jun-2022 +###### Auto generated by spf13/cobra on 4-Jul-2022 diff --git a/examples/demo-empty-project/proj.json b/examples/demo-empty-project/proj.json index 7405d8a2..fe59965d 100644 --- a/examples/demo-empty-project/proj.json +++ b/examples/demo-empty-project/proj.json @@ -1,5 +1,5 @@ { "project_name": "demo-empty-project", - "create_time": "2022-06-27T16:52:45.660111+08:00", - "hrp_version": "v4.1.4" + "create_time": "2022-07-04T14:54:33.795693+08:00", + "hrp_version": "v4.1.5" } diff --git a/examples/demo-with-go-plugin/proj.json b/examples/demo-with-go-plugin/proj.json index 33679c33..08ee1070 100644 --- a/examples/demo-with-go-plugin/proj.json +++ b/examples/demo-with-go-plugin/proj.json @@ -1,5 +1,5 @@ { "project_name": "demo-with-go-plugin", - "create_time": "2022-06-27T16:51:52.779837+08:00", - "hrp_version": "v4.1.4" + "create_time": "2022-07-04T14:53:59.755944+08:00", + "hrp_version": "v4.1.5" } diff --git a/examples/demo-with-py-plugin/proj.json b/examples/demo-with-py-plugin/proj.json index fca33a09..6c789922 100644 --- a/examples/demo-with-py-plugin/proj.json +++ b/examples/demo-with-py-plugin/proj.json @@ -1,5 +1,5 @@ { "project_name": "demo-with-py-plugin", - "create_time": "2022-06-27T16:51:54.32061+08:00", - "hrp_version": "v4.1.4" + "create_time": "2022-07-04T14:54:00.346082+08:00", + "hrp_version": "v4.1.5" } diff --git a/examples/demo-without-plugin/proj.json b/examples/demo-without-plugin/proj.json index 29065d5b..24b61c18 100644 --- a/examples/demo-without-plugin/proj.json +++ b/examples/demo-without-plugin/proj.json @@ -1,5 +1,5 @@ { "project_name": "demo-without-plugin", - "create_time": "2022-06-27T16:52:45.363472+08:00", - "hrp_version": "v4.1.4" + "create_time": "2022-07-04T14:54:33.495643+08:00", + "hrp_version": "v4.1.5" } diff --git a/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py b/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py index a57fef72..70910180 100644 --- a/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py +++ b/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py @@ -1,4 +1,4 @@ -# NOTE: Generated By hrp v4.1.4, DO NOT EDIT! +# NOTE: Generated By hrp v4.1.5, DO NOT EDIT! import sys import os diff --git a/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go b/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go index 6e6c9067..0ee1ae22 100644 --- a/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go +++ b/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go @@ -1,4 +1,4 @@ -// NOTE: Generated By hrp v4.1.4, DO NOT EDIT! +// NOTE: Generated By hrp v4.1.5, DO NOT EDIT! package main import ( diff --git a/hrp/step_request.go b/hrp/step_request.go index 8603bf1e..f39fedfa 100644 --- a/hrp/step_request.go +++ b/hrp/step_request.go @@ -271,14 +271,11 @@ func prepareUpload(parser *Parser, step *TStep, stepVariables map[string]interfa if step.Request.Upload == nil { return } - uploadSlice := map[string]interface{}{} - for key, value := range step.Request.Upload { - uploadSlice[key], err = parser.Parse(value, stepVariables) - if err != nil { - return - } + uploadMap, err := parser.Parse(step.Request.Upload, stepVariables) + if err != nil { + return } - stepVariables["m_upload"] = uploadSlice + stepVariables["m_upload"] = uploadMap mEncoder, err := parser.Parse("${multipart_encoder($m_upload)}", stepVariables) if err != nil { return