mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
Merge pull request #1602 from test-instructor/fix_hooks
fix: dump request headers and params in hooks
This commit is contained in:
+13
-4
@@ -363,10 +363,19 @@ func runStepRequest(r *SessionRunner, step *TStep) (stepResult *StepResult, err
|
|||||||
rb.req.ContentLength = int64(len(body))
|
rb.req.ContentLength = int64(len(body))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
headers, ok := rb.requestMap["headers"].(map[string]string)
|
requestParams, ok := rb.requestMap["params"].(map[string]interface{})
|
||||||
rb.req.Header = map[string][]string{}
|
if ok {
|
||||||
for key, value := range headers {
|
params, err := json.Marshal(requestParams)
|
||||||
rb.req.Header.Set(key, value)
|
if err == nil {
|
||||||
|
rb.req.URL.RawQuery = string(params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requestHeaders, ok := rb.requestMap["headers"].(map[string]interface{})
|
||||||
|
if ok {
|
||||||
|
rb.req.Header = http.Header{}
|
||||||
|
for k, v := range requestHeaders {
|
||||||
|
rb.req.Header.Set(k, v.(string))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user