aboutsummaryrefslogtreecommitdiff
path: root/brotli_test.go
AgeCommit message (Collapse)AuthorFilesLines
2024-02-21Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722)Gravatar Oleksandr Redko 1-6/+6
2023-04-28test: refactor to use WriteString (#1546)v1.47.0Gravatar Oleksandr Redko 1-1/+1
2022-09-15Deprecate Go 1.15 (#1379)Gravatar Aoang 1-2/+2
* Dropping support for 1.15. * Replaces Go 1.16 Deprecated functions * Update test build flag * Fix import sort and comment * Update github.com/klauspost/compress to v1.15.9 https://github.com/klauspost/compress improved performance and changed Minimum version is 1.16, this should be the final supported release for Go 1.16 (https://github.com/klauspost/compress/commit/6d0019a95afa3221f7522d1f2eed0033b5e79470) .
2022-06-05Response.ContentEncoding(): store as field and avoid using ↵Gravatar Sergey Ponomarev 1-3/+3
Header.SetCanonical() (#1311) * Response.ContentEncoding(): store as field The CE is not so often used for plain APIs responses and even not so often used for static files and on the fly compression. But still it should be checked each time. Also having a dedicated field getter and setter simplifies code * header.go Use shorter Response.setNonSpecial() and Request.setNonSpecial() methods instead of SetCanonical() The change should improve performance because the setSpecialHeader() call is omitted. As a downside on adding a new basic header field all putHeader() must be replaced with a direct getter and setter.
2022-04-01Use %v for errors and %q for strings (#1262)v1.35.0Gravatar Erik Dubbelboer 1-5/+5
Mostly in tests.
2021-12-13Use %w to wrap errors (#1175)Gravatar Erik Dubbelboer 1-4/+4
2020-05-15Add Brotli supportGravatar Erik Dubbelboer 1-0/+177
New Functions: CompressHandlerBrotliLevel(h RequestHandler, brotliLevel, otherLevel int) RequestHandler Request.BodyUnbrotli() ([]byte, error) Response.BodyUnbrotli() ([]byte, error) AppendBrotliBytesLevel(dst, src []byte, level int) []byte WriteBrotliLevel(w io.Writer, p []byte, level int) (int, error) WriteBrotli(w io.Writer, p []byte) (int, error) AppendBrotliBytes(dst, src []byte) []byte WriteUnbrotli(w io.Writer, p []byte) (int, error) AppendUnbrotliBytes(dst, src []byte) ([]byte, error) New Constants: CompressBrotliNoCompression CompressBrotliBestSpeed CompressBrotliBestCompression CompressBrotliDefaultCompression Brotli compression levels are different from gzip/flate. Because of this we have separate level constants and CompressHandlerBrotliLevel takes 2 levels. I didn't add Brotli support to CompressHandler as this could cause a spike in CPU usage when users upgrade fasthttp. fasthttp.CompressBrotliDefaultCompression is not the same as brotli.DefaultCompression. brotli.DefaultCompression is more than twice as slow as fasthttp.CompressBrotliDefaultCompression which I thought was unreasonable as default.