@marcel91200 / caddy Mirror · read-only
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 01:00 UTC

master
go 17 lines 360 Bytes
Raw
1 package encode
2
3 import (
4 "net/http"
5 "net/http/httptest"
6 "testing"
7 )
8
9 func BenchmarkAcceptedEncodings(b *testing.B) {
10 r := httptest.NewRequest(http.MethodGet, "/", nil)
11 r.Header.Set("Accept-Encoding", "gzip, deflate, br;q=0.9, zstd;q=0.8")
12 prefer := []string{"zstd", "br", "gzip"}
13 b.ReportAllocs()
14 for b.Loop() {
15 _ = AcceptedEncodings(r, prefer)
16 }
17 }