mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: Connection and Content-Type not found in postman-echo headers
Change-Id: Ieae673e12c7baabe231d7f3509bba18624d80431
This commit is contained in:
@@ -24,10 +24,8 @@ func TestCaseValidateStep(t *testing.T) {
|
||||
Extract().
|
||||
WithJmesPath("body.args.foo1", "varFoo1").
|
||||
Validate().
|
||||
AssertEqual("status_code", "$expectedStatusCode", "check status code"). // assert status code
|
||||
AssertEqual("headers.Connection", "keep-alive", "check header Connection"). // assert response header
|
||||
AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check header Content-Type"). // assert response header, with double quotes
|
||||
AssertEqual("body.args.foo1", "bar1", "check args foo1"). // assert response json body with jmespath
|
||||
AssertEqual("status_code", "$expectedStatusCode", "check status code"). // assert status code
|
||||
AssertEqual("body.args.foo1", "bar1", "check args foo1"). // assert response json body with jmespath
|
||||
AssertEqual("body.args.foo2", "bar2", "check args foo2").
|
||||
AssertEqual("body.headers.\"user-agent\"", "HttpRunnerPlus", "check header user agent"),
|
||||
hrp.NewStep("get with params").
|
||||
@@ -40,12 +38,10 @@ func TestCaseValidateStep(t *testing.T) {
|
||||
WithHeaders(map[string]string{"User-Agent": "$agent"}).
|
||||
Extract().
|
||||
WithJmesPath("status_code", "statusCode").
|
||||
WithJmesPath("headers.\"Content-Type\"", "contentType").
|
||||
Validate().
|
||||
AssertEqual("$statusCode", 200, "check status code"). // assert with extracted variable from current step
|
||||
AssertEqual("$contentType", "application/json; charset=utf-8", "check header Content-Type"). // assert with extracted variable from current step
|
||||
AssertEqual("$varFoo1", "bar1", "check args foo1"). // assert with extracted variable from previous step
|
||||
AssertEqual("body.args.foo2", "bar2", "check args foo2"), // assert response json body with jmespath
|
||||
AssertEqual("$statusCode", 200, "check status code"). // assert with extracted variable from current step
|
||||
AssertEqual("$varFoo1", "bar1", "check args foo1"). // assert with extracted variable from previous step
|
||||
AssertEqual("body.args.foo2", "bar2", "check args foo2"), // assert response json body with jmespath
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user