diff options
author | Oleksandr Redko <oleksandr.red+github@gmail.com> | 2024-02-21 06:51:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-21 05:51:28 +0100 |
commit | 190204cf1a4f9999e2739d3825967df445d82d7c (patch) | |
tree | d1acd3796778b24edfd2677e52ed69a1ca3eae5c /header_test.go | |
parent | Remove unnecessary build tag go1.21 (#1721) (diff) | |
download | fasthttp-190204cf1a4f9999e2739d3825967df445d82d7c.tar.gz fasthttp-190204cf1a4f9999e2739d3825967df445d82d7c.tar.bz2 fasthttp-190204cf1a4f9999e2739d3825967df445d82d7c.zip |
Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722)
Diffstat (limited to 'header_test.go')
-rw-r--r-- | header_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/header_test.go b/header_test.go index d6da8e2..e7a6fad 100644 --- a/header_test.go +++ b/header_test.go @@ -167,7 +167,7 @@ func TestResponseHeaderEmptyValueFromHeader(t *testing.T) { if err := h.Read(br); err != nil { t.Fatalf("unexpected error: %v", err) } - if string(h.ContentType()) != string(h1.ContentType()) { + if !bytes.Equal(h.ContentType(), h1.ContentType()) { t.Fatalf("unexpected content-type: %q. Expecting %q", h.ContentType(), h1.ContentType()) } v1 := h.Peek("EmptyValue1") @@ -222,7 +222,7 @@ func TestRequestHeaderEmptyValueFromHeader(t *testing.T) { if err := h.Read(br); err != nil { t.Fatalf("unexpected error: %v", err) } - if string(h.Host()) != string(h1.Host()) { + if !bytes.Equal(h.Host(), h1.Host()) { t.Fatalf("unexpected host: %q. Expecting %q", h.Host(), h1.Host()) } v1 := h.Peek("EmptyValue1") @@ -341,7 +341,7 @@ func TestRequestRawHeaders(t *testing.T) { if err := h.Read(br); err != nil { t.Fatalf("unexpected error: %v", err) } - if string(h.Host()) != "" { + if len(h.Host()) != 0 { t.Fatalf("unexpected host: %q. Expecting %q", h.Host(), "") } v1 := h.Peek("NoKey") @@ -687,11 +687,11 @@ func TestResponseHeaderDel(t *testing.T) { t.Fatalf("non-zero value: %q", hv) } hv = h.Peek(HeaderContentType) - if string(hv) != string(defaultContentType) { + if !bytes.Equal(hv, defaultContentType) { t.Fatalf("unexpected content-type: %q. Expecting %q", hv, defaultContentType) } hv = h.Peek(HeaderContentEncoding) - if string(hv) != ("gzip") { + if string(hv) != "gzip" { t.Fatalf("unexpected content-encoding: %q. Expecting %q", hv, "gzip") } hv = h.Peek(HeaderServer) @@ -1519,7 +1519,7 @@ func TestRequestContentTypeNoDefault(t *testing.T) { t.Fatalf("Unexpected error: %v", err) } - if string(h1.contentType) != "" { + if len(h1.contentType) != 0 { t.Fatalf("unexpected Content-Type %q. Expecting %q", h1.contentType, "") } } @@ -2121,7 +2121,7 @@ func testRequestHeaderMethod(t *testing.T, expectedMethod string) { t.Fatalf("unexpected error: %v", err) } m1 := h1.Method() - if string(m) != string(m1) { + if !bytes.Equal(m, m1) { t.Fatalf("unexpected method: %q. Expecting %q", m, m1) } } |