From b1fdd4be71c78e2eaee2aeaf9b012d386043a08d Mon Sep 17 00:00:00 2001 From: buyuxiang <347586493@qq.com> Date: Mon, 14 Feb 2022 16:06:34 +0800 Subject: [PATCH] fix: Connection and Content-Type not found in postman-echo headers Change-Id: Ieae673e12c7baabe231d7f3509bba18624d80431 --- examples/extract_test.go | 3 --- examples/request_test.go | 2 -- examples/validate_test.go | 14 +++++--------- examples/variables_test.go | 6 ------ step_test.go | 2 -- 5 files changed, 5 insertions(+), 22 deletions(-) diff --git a/examples/extract_test.go b/examples/extract_test.go index ec72277d..ac1d27b2 100644 --- a/examples/extract_test.go +++ b/examples/extract_test.go @@ -58,12 +58,9 @@ func TestCaseExtractStepAssociation(t *testing.T) { WithHeaders(map[string]string{"User-Agent": "$agent"}). Extract(). WithJmesPath("status_code", "statusCode"). - WithJmesPath("headers.\"Content-Type\"", "contentType"). WithJmesPath("body.args.foo1", "varFoo1"). Validate(). AssertEqual("$statusCode", 200, "check status code"). - AssertEqual("headers.Connection", "keep-alive", "check header Connection"). - AssertEqual("$contentType", "application/json; charset=utf-8", "check header Content-Type"). AssertEqual("$varFoo1", "bar1", "check args foo1"). AssertEqual("body.args.foo2", "bar2", "check args foo2"). AssertEqual("body.headers.\"user-agent\"", "HttpRunnerPlus", "check header user agent"), diff --git a/examples/request_test.go b/examples/request_test.go index 6312df07..6394cee6 100644 --- a/examples/request_test.go +++ b/examples/request_test.go @@ -20,8 +20,6 @@ func TestCaseBasicRequest(t *testing.T) { }). Validate(). AssertEqual("status_code", 200, "check status code"). - AssertEqual("headers.Connection", "keep-alive", "check header Connection"). - AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check header Content-Type"). AssertEqual("body.args.foo1", "bar1", "check args foo1"). AssertEqual("body.args.foo2", "bar2", "check args foo2"), hrp.NewStep("post raw text"). diff --git a/examples/validate_test.go b/examples/validate_test.go index 24d60e25..941ea5c0 100644 --- a/examples/validate_test.go +++ b/examples/validate_test.go @@ -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 }, } diff --git a/examples/variables_test.go b/examples/variables_test.go index 9fb4c0fb..d9875237 100644 --- a/examples/variables_test.go +++ b/examples/variables_test.go @@ -22,8 +22,6 @@ func TestCaseConfigVariables(t *testing.T) { WithHeaders(map[string]string{"User-Agent": "$agent"}). Validate(). AssertEqual("status_code", "$expectedStatusCode", "check status code"). - AssertEqual("headers.Connection", "keep-alive", "check header Connection"). - AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check header Content-Type"). AssertEqual("body.args.foo1", "bar1", "check args foo1"). AssertEqual("body.args.foo2", "bar2", "check args foo2"). AssertEqual("body.headers.\"user-agent\"", "HttpRunnerPlus", "check header user agent"), @@ -53,8 +51,6 @@ func TestCaseStepVariables(t *testing.T) { WithHeaders(map[string]string{"User-Agent": "$agent"}). Validate(). AssertEqual("status_code", "$expectedStatusCode", "check status code"). - AssertEqual("headers.Connection", "keep-alive", "check header Connection"). - AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check header Content-Type"). AssertEqual("body.args.foo1", "bar1", "check args foo1"). AssertEqual("body.args.foo2", "bar2", "check args foo2"). AssertEqual("body.headers.\"user-agent\"", "HttpRunnerPlus", "check header user agent"), @@ -88,8 +84,6 @@ func TestCaseOverrideConfigVariables(t *testing.T) { WithHeaders(map[string]string{"User-Agent": "$agent"}). Validate(). AssertEqual("status_code", "$expectedStatusCode", "check status code"). - AssertEqual("headers.Connection", "keep-alive", "check header Connection"). - AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check header Content-Type"). AssertEqual("body.args.foo1", "bar1", "check args foo1"). AssertEqual("body.args.foo2", "bar2", "check args foo2"). AssertEqual("body.headers.\"user-agent\"", "HttpRunnerPlus", "check header user agent"), diff --git a/step_test.go b/step_test.go index 5eb6427f..578f50ef 100644 --- a/step_test.go +++ b/step_test.go @@ -12,8 +12,6 @@ var ( WithCookies(map[string]string{"user": "debugtalk"}). Validate(). AssertEqual("status_code", 200, "check status code"). - AssertEqual("headers.Connection", "keep-alive", "check header Connection"). - AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check header Content-Type"). AssertEqual("body.args.foo1", "bar1", "check param foo1"). AssertEqual("body.args.foo2", "bar2", "check param foo2") stepPOSTData = NewStep("post form data").