diff options
author | Oleksandr Redko <oleksandr.red+github@gmail.com> | 2024-04-02 19:00:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-02 17:00:44 +0100 |
commit | 1c3ba3b2f0e3171f7628df03e00d8abf71f30a64 (patch) | |
tree | f941999a272963dd931d089725d4ac1e675c479d | |
parent | fix: panic in ParseIPv4 when len(dst) > 4 (#1742) (diff) | |
download | fasthttp-1c3ba3b2f0e3171f7628df03e00d8abf71f30a64.tar.gz fasthttp-1c3ba3b2f0e3171f7628df03e00d8abf71f30a64.tar.bz2 fasthttp-1c3ba3b2f0e3171f7628df03e00d8abf71f30a64.zip |
test: replace panic with returning error (#1747)
-rw-r--r-- | client_test.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/client_test.go b/client_test.go index 4842965..468d447 100644 --- a/client_test.go +++ b/client_test.go @@ -2003,9 +2003,8 @@ func TestClientNonIdempotentRetry(t *testing.T) { s: "HTTP/1.1 345 OK\r\nContent-Type: foobar\r\nContent-Length: 7\r\n\r\n0123456", }, nil default: - t.Fatalf("unexpected number of dials: %d", dialsCount) + return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount) } - panic("unreachable") }, } @@ -2053,9 +2052,8 @@ func TestClientNonIdempotentRetry_BodyStream(t *testing.T) { b: []byte("HTTP/1.1 345 OK\r\nContent-Type: foobar\r\n\r\n"), }, nil default: - t.Fatalf("unexpected number of dials: %d", dialsCount) + return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount) } - panic("unreachable") }, } @@ -2096,9 +2094,8 @@ func TestClientIdempotentRequest(t *testing.T) { s: "HTTP/1.1 345 OK\r\nContent-Type: foobar\r\nContent-Length: 7\r\n\r\n0123456", }, nil default: - t.Fatalf("unexpected number of dials: %d", dialsCount) + return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount) } - panic("unreachable") }, } @@ -2152,9 +2149,8 @@ func TestClientRetryRequestWithCustomDecider(t *testing.T) { s: "HTTP/1.1 345 OK\r\nContent-Type: foobar\r\nContent-Length: 7\r\n\r\n0123456", }, nil default: - t.Fatalf("unexpected number of dials: %d", dialsCount) + return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount) } - panic("unreachable") }, RetryIf: func(req *Request) bool { return req.URI().String() == "http://foobar/a/b" |