From 73a9fb371e08d98074f075312592c495602fd5c1 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 22 Jun 2022 18:42:25 +0800 Subject: [PATCH] fix: insert response cookies into request for redirect requests --- docs/CHANGELOG.md | 1 + hrp/runner.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b857f6fa..7196c7ba 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,7 @@ **go version** - change: set http request timeout default to 120s +- fix: insert response cookies into request for redirect requests ## v4.1.4 (2022-06-17) diff --git a/hrp/runner.go b/hrp/runner.go index cd1675fa..b7b24b17 100644 --- a/hrp/runner.go +++ b/hrp/runner.go @@ -4,6 +4,7 @@ import ( "crypto/tls" "net" "net/http" + "net/http/cookiejar" "net/url" "path/filepath" "testing" @@ -29,6 +30,7 @@ func NewRunner(t *testing.T) *HRPRunner { if t == nil { t = &testing.T{} } + jar, _ := cookiejar.New(nil) return &HRPRunner{ t: t, failfast: true, // default to failfast @@ -37,6 +39,7 @@ func NewRunner(t *testing.T) *HRPRunner { Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, + Jar: jar, // insert response cookies into request Timeout: 120 * time.Second, }, http2Client: &http.Client{