aboutsummaryrefslogtreecommitdiff
path: root/client_test.go
diff options
context:
space:
mode:
authorGravatar ArminBTVS <98586621+ArminBTVS@users.noreply.github.com> 2022-01-31 15:02:58 +0100
committerGravatar GitHub <noreply@github.com> 2022-01-31 22:02:58 +0800
commit8d7953eda77b3f5f42a4aa61e6eff1ea42815dfe (patch)
tree9886ae0e24edfedf6d9c44e9e05ce69a7bc47e54 /client_test.go
parentremove redundant code (#1202) (diff)
downloadfasthttp-8d7953eda77b3f5f42a4aa61e6eff1ea42815dfe.tar.gz
fasthttp-8d7953eda77b3f5f42a4aa61e6eff1ea42815dfe.tar.bz2
fasthttp-8d7953eda77b3f5f42a4aa61e6eff1ea42815dfe.zip
Fix scheme check for not yet parsed requests (#1203)
* Fix scheme check for not yet parsed requests At this point the request might not be parsed yet and set. In that case uri is empty and isHttps() returns always false. I don't expect this is intended? Otherwise URL() must be called before actually passing the request to client.Do() * Add test * Please linter
Diffstat (limited to 'client_test.go')
-rw-r--r--client_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/client_test.go b/client_test.go
index 033284d..e5c4f43 100644
--- a/client_test.go
+++ b/client_test.go
@@ -2820,3 +2820,23 @@ func TestHostClientMaxConnWaitTimeoutWithEarlierDeadline(t *testing.T) {
t.Fatalf("at least one request body was empty")
}
}
+
+func TestHttpsRequestWithoutParsedURL(t *testing.T) {
+ t.Parallel()
+
+ client := HostClient{
+ IsTLS: true,
+ Transport: func(r1 *Request, r2 *Response) error {
+ return nil
+ },
+ }
+
+ req := &Request{}
+
+ req.SetRequestURI("https://foo.com/bar")
+
+ _, err := client.doNonNilReqResp(req, &Response{})
+ if err != nil {
+ t.Fatalf("https requests with IsTLS client must succeed")
+ }
+}