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 /brotli_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 'brotli_test.go')
-rw-r--r-- | brotli_test.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/brotli_test.go b/brotli_test.go index 7833c41..794ab45 100644 --- a/brotli_test.go +++ b/brotli_test.go @@ -105,9 +105,9 @@ func testBrotliCompressSingleCase(s string) error { func TestCompressHandlerBrotliLevel(t *testing.T) { t.Parallel() - expectedBody := string(createFixedBody(2e4)) + expectedBody := createFixedBody(2e4) h := CompressHandlerBrotliLevel(func(ctx *RequestCtx) { - ctx.WriteString(expectedBody) //nolint:errcheck + ctx.Write(expectedBody) //nolint:errcheck }, CompressBrotliDefaultCompression, CompressDefaultCompression) var ctx RequestCtx @@ -121,11 +121,11 @@ func TestCompressHandlerBrotliLevel(t *testing.T) { t.Fatalf("unexpected error: %v", err) } ce := resp.Header.ContentEncoding() - if string(ce) != "" { + if len(ce) != 0 { t.Fatalf("unexpected Content-Encoding: %q. Expecting %q", ce, "") } body := resp.Body() - if string(body) != expectedBody { + if !bytes.Equal(body, expectedBody) { t.Fatalf("unexpected body %q. Expecting %q", body, expectedBody) } @@ -148,7 +148,7 @@ func TestCompressHandlerBrotliLevel(t *testing.T) { if err != nil { t.Fatalf("unexpected error: %v", err) } - if string(body) != expectedBody { + if !bytes.Equal(body, expectedBody) { t.Fatalf("unexpected body %q. Expecting %q", body, expectedBody) } @@ -171,7 +171,7 @@ func TestCompressHandlerBrotliLevel(t *testing.T) { if err != nil { t.Fatalf("unexpected error: %v", err) } - if string(body) != expectedBody { + if !bytes.Equal(body, expectedBody) { t.Fatalf("unexpected body %q. Expecting %q", body, expectedBody) } } |