mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
feat: support post json
This commit is contained in:
@@ -32,6 +32,12 @@ func TestCaseHardcode(t *testing.T) {
|
||||
WithParams(map[string]interface{}{"foo1": "bar1", "foo2": "bar2"}).
|
||||
Validate().
|
||||
AssertEqual("status_code", 200, "check status code"),
|
||||
httpboomer.Step("post json data").
|
||||
POST("/post").
|
||||
WithHeaders(map[string]string{"User-Agent": "HttpBoomer"}).
|
||||
WithJSON(map[string]interface{}{"foo1": "bar1", "foo2": "bar2"}).
|
||||
Validate().
|
||||
AssertEqual("status_code", 200, "check status code"),
|
||||
httpboomer.Step("put request").
|
||||
PUT("/put").
|
||||
WithHeaders(map[string]string{"User-Agent": "HttpBoomer", "Content-Type": "text/plain"}).
|
||||
|
||||
@@ -59,6 +59,7 @@ func (r *Runner) runStep(step *TStep) error {
|
||||
v = append(v, req.Header(step.Request.Headers))
|
||||
v = append(v, req.Param(step.Request.Params))
|
||||
v = append(v, step.Request.Data)
|
||||
v = append(v, req.BodyJSON(step.Request.JSON))
|
||||
|
||||
for cookieName, cookieValue := range step.Request.Cookies {
|
||||
v = append(v, &http.Cookie{
|
||||
|
||||
Reference in New Issue
Block a user