mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: unittest
This commit is contained in:
@@ -315,7 +315,7 @@ func runStepRequest(r *SessionRunner, step *TStep) (stepResult *StepResult, err
|
||||
// stat HTTP request
|
||||
var httpStat httpstat.Stat
|
||||
if r.HTTPStatOn() {
|
||||
ctx := httpstat.WithHTTPStat(rb.req.Context(), &httpStat)
|
||||
ctx := httpstat.WithHTTPStat(rb.req, &httpStat)
|
||||
rb.req = rb.req.WithContext(ctx)
|
||||
}
|
||||
|
||||
@@ -347,12 +347,6 @@ func runStepRequest(r *SessionRunner, step *TStep) (stepResult *StepResult, err
|
||||
}
|
||||
}
|
||||
|
||||
if r.HTTPStatOn() {
|
||||
httpStat.Finish()
|
||||
stepResult.HttpStat = httpStat.Durations()
|
||||
httpStat.Print()
|
||||
}
|
||||
|
||||
// new response object
|
||||
respObj, err := newHttpResponseObject(r.hrpRunner.t, parser, resp)
|
||||
if err != nil {
|
||||
@@ -360,6 +354,13 @@ func runStepRequest(r *SessionRunner, step *TStep) (stepResult *StepResult, err
|
||||
return
|
||||
}
|
||||
|
||||
if r.HTTPStatOn() {
|
||||
// resp.Body has been ReadAll
|
||||
httpStat.Finish()
|
||||
stepResult.HttpStat = httpStat.Durations()
|
||||
httpStat.Print()
|
||||
}
|
||||
|
||||
// add response object to step variables, could be used in teardown hooks
|
||||
stepVariables["hrp_step_response"] = respObj.respObjMeta
|
||||
|
||||
|
||||
Reference in New Issue
Block a user