Benchmark_Utils_GetOffer() — fiber Function Reference
Architecture documentation for the Benchmark_Utils_GetOffer() function in helpers_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD eca1410c_2dfd_a315_d5c3_04442c1b8a37["Benchmark_Utils_GetOffer()"] c82e3595_b1b8_f596_c097_f26fa40159d1["helpers_test.go"] eca1410c_2dfd_a315_d5c3_04442c1b8a37 -->|defined in| c82e3595_b1b8_f596_c097_f26fa40159d1 style eca1410c_2dfd_a315_d5c3_04442c1b8a37 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
helpers_test.go lines 237–321
func Benchmark_Utils_GetOffer(b *testing.B) {
testCases := []struct {
description string
accept string
offers []string
}{
{
description: "simple",
accept: "application/json",
offers: []string{"application/json"},
},
{
description: "6 offers",
accept: "text/plain",
offers: []string{"junk/a", "junk/b", "junk/c", "junk/d", "junk/e", "text/plain"},
},
{
description: "1 parameter",
accept: "application/json; version=1",
offers: []string{"application/json;version=1"},
},
{
description: "2 parameters",
accept: "application/json; version=1; foo=bar",
offers: []string{"application/json;version=1;foo=bar"},
},
{
description: "3 parameters",
accept: "application/json; version=1; foo=bar; charset=utf-8",
offers: []string{"application/json;version=1;foo=bar;charset=utf-8"},
},
{
description: "10 parameters",
accept: "text/plain;a=1;b=2;c=3;d=4;e=5;f=6;g=7;h=8;i=9;j=10",
offers: []string{"text/plain;a=1;b=2;c=3;d=4;e=5;f=6;g=7;h=8;i=9;j=10"},
},
{
description: "6 offers w/params",
accept: "text/plain; format=flowed",
offers: []string{
"junk/a;a=b",
"junk/b;b=c",
"junk/c;c=d",
"text/plain; format=justified",
"text/plain; format=flat",
"text/plain; format=flowed",
},
},
{
description: "mime extension",
accept: "utf-8, iso-8859-1;q=0.5",
offers: []string{"utf-8"},
},
{
description: "mime extension",
accept: "utf-8, iso-8859-1;q=0.5",
offers: []string{"iso-8859-1"},
},
{
description: "mime extension",
accept: "utf-8, iso-8859-1;q=0.5",
offers: []string{"iso-8859-1", "utf-8"},
},
{
description: "mime extension",
accept: "gzip, deflate",
offers: []string{"deflate"},
},
{
description: "web browser",
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
offers: []string{"text/html", "application/xml", "application/xml+xhtml"},
},
}
b.ReportAllocs()
for _, tc := range testCases {
accept := []byte(tc.accept)
b.Run(tc.description, func(b *testing.B) {
for b.Loop() {
getOffer(accept, acceptsOfferType, tc.offers...)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Benchmark_Utils_GetOffer() do?
Benchmark_Utils_GetOffer() is a function in the fiber codebase, defined in helpers_test.go.
Where is Benchmark_Utils_GetOffer() defined?
Benchmark_Utils_GetOffer() is defined in helpers_test.go at line 237.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free