helpers_test.go — fiber Source File
Architecture documentation for helpers_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c82e3595_b1b8_f596_c097_f26fa40159d1["helpers_test.go"] c0b86961_3ef1_0168_52fc_98627566ed27["bytes"] c82e3595_b1b8_f596_c097_f26fa40159d1 --> c0b86961_3ef1_0168_52fc_98627566ed27 style c82e3595_b1b8_f596_c097_f26fa40159d1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 📝 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io
package fiber
import (
"bytes"
"crypto/tls"
"math"
"net"
"os"
"strconv"
"testing"
"time"
"unsafe"
"github.com/gofiber/utils/v2"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_Utils_GetOffer(t *testing.T) {
t.Parallel()
require.Empty(t, getOffer([]byte("hello"), acceptsOffer))
require.Equal(t, "1", getOffer([]byte(""), acceptsOffer, "1"))
require.Empty(t, getOffer([]byte("2"), acceptsOffer, "1"))
require.Empty(t, getOffer([]byte(""), acceptsOfferType))
require.Empty(t, getOffer([]byte("text/html"), acceptsOfferType))
require.Empty(t, getOffer([]byte("text/html"), acceptsOfferType, "application/json"))
require.Empty(t, getOffer([]byte("text/html;q=0"), acceptsOfferType, "text/html"))
require.Empty(t, getOffer([]byte("application/json, */*; q=0"), acceptsOfferType, "image/png"))
require.Equal(t, "application/xml", getOffer([]byte("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), acceptsOfferType, "application/xml", "application/json"))
require.Equal(t, "text/html", getOffer([]byte("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), acceptsOfferType, "text/html"))
require.Equal(t, "application/pdf", getOffer([]byte("text/plain;q=0,application/pdf;q=0.9,*/*;q=0.000"), acceptsOfferType, "application/pdf", "application/json"))
require.Equal(t, "application/pdf", getOffer([]byte("text/plain;q=0,application/pdf;q=0.9,*/*;q=0.000"), acceptsOfferType, "application/pdf", "application/json"))
require.Equal(t, "text/plain;a=1", getOffer([]byte("text/plain;a=1"), acceptsOfferType, "text/plain;a=1"))
require.Empty(t, getOffer([]byte("text/plain;a=1;b=2"), acceptsOfferType, "text/plain;b=2"))
// Spaces, quotes, out of order params, and case insensitivity
require.Equal(t, "text/plain", getOffer([]byte("text/plain "), acceptsOfferType, "text/plain"))
require.Equal(t, "text/plain", getOffer([]byte("text/plain;q=0.4 "), acceptsOfferType, "text/plain"))
require.Equal(t, "text/plain", getOffer([]byte("text/plain;q=0.4 ;"), acceptsOfferType, "text/plain"))
require.Equal(t, "text/plain", getOffer([]byte("text/plain;q=0.4 ; p=foo"), acceptsOfferType, "text/plain"))
require.Equal(t, "text/plain;b=2;a=1", getOffer([]byte("text/plain ;a=1;b=2"), acceptsOfferType, "text/plain;b=2;a=1"))
require.Equal(t, "text/plain;a=1", getOffer([]byte("text/plain; a=1 "), acceptsOfferType, "text/plain;a=1"))
require.Equal(t, `text/plain;a="1;b=2\",text/plain"`, getOffer([]byte(`text/plain;a="1;b=2\",text/plain";q=0.9`), acceptsOfferType, `text/plain;a=1;b=2`, `text/plain;a="1;b=2\",text/plain"`))
require.Equal(t, "text/plain;A=CAPS", getOffer([]byte(`text/plain;a="caPs"`), acceptsOfferType, "text/plain;A=CAPS"))
// Priority
require.Equal(t, "text/plain", getOffer([]byte("text/plain"), acceptsOfferType, "text/plain", "text/plain;a=1"))
require.Equal(t, "text/plain;a=1", getOffer([]byte("text/plain"), acceptsOfferType, "text/plain;a=1", "", "text/plain"))
require.Equal(t, "text/plain;a=1", getOffer([]byte("text/plain,text/plain;a=1"), acceptsOfferType, "text/plain", "text/plain;a=1"))
require.Equal(t, "text/plain", getOffer([]byte("text/plain;q=0.899,text/plain;a=1;q=0.898"), acceptsOfferType, "text/plain", "text/plain;a=1"))
require.Equal(t, "text/plain;a=1;b=2", getOffer([]byte("text/plain,text/plain;a=1,text/plain;a=1;b=2"), acceptsOfferType, "text/plain", "text/plain;a=1", "text/plain;a=1;b=2"))
// Takes the last value specified
require.Equal(t, "text/plain;a=1;b=2", getOffer([]byte("text/plain;a=1;b=1;B=2"), acceptsOfferType, "text/plain;a=1;b=1", "text/plain;a=1;b=2"))
// ... (1592 more lines)
Domain
Subdomains
Functions
- Benchmark_GenericParseTypeBoolean()
- Benchmark_GenericParseTypeBytes()
- Benchmark_GenericParseTypeFloats()
- Benchmark_GenericParseTypeInts()
- Benchmark_GenericParseTypeString()
- Benchmark_GenericParseTypeUints()
- Benchmark_HeaderContainsValue()
- Benchmark_Utils_GetOffer()
- Benchmark_Utils_GetSplicedStrList()
- Benchmark_Utils_IsNoCache()
- Benchmark_Utils_ParamsMatch()
- Benchmark_Utils_SortAcceptedTypes_Sorted()
- Benchmark_Utils_SortAcceptedTypes_Unsorted()
- Benchmark_Utils_Unescape()
- Benchmark_Utils_getGroupPath()
- Test_App_quoteRawString()
- Test_GenericParseTypeBoolean()
- Test_GenericParseTypeBytes()
- Test_GenericParseTypeFloats()
- Test_GenericParseTypeInts()
- Test_GenericParseTypeString()
- Test_GenericParseTypeUints()
- Test_GetTLSConfig()
- Test_HeaderContainsValue()
- Test_IsEtagStale()
- Test_JoinHeaderValues()
- Test_MatchEtag()
- Test_MatchEtagStrong()
- Test_ParamsMatch_InvalidEscape()
- Test_ReadContentReturnsBytes()
- Test_UnescapeHeaderValue()
- Test_Utils_AcceptsOfferType()
- Test_Utils_GetOffer()
- Test_Utils_GetSplicedStrList()
- Test_Utils_IsNoCache()
- Test_Utils_ParamsMatch()
- Test_Utils_Parse_Address()
- Test_Utils_SortAcceptedTypes()
- Test_Utils_TestConn_Closed_Write()
- Test_Utils_TestConn_Deadline()
- Test_Utils_TestConn_ReadWrite()
- Test_Utils_UniqueRouteStack()
- Test_Utils_getGroupPath()
- benchGenericParseTypeInt()
- benchGenericParseTypeUInt()
- newLocalListener()
- testGenericParseError()
- testGenericTypeInt()
- testGenericTypeUint()
Types
Dependencies
- bytes
Source
Frequently Asked Questions
What does helpers_test.go do?
helpers_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Routing subdomain.
What functions are defined in helpers_test.go?
helpers_test.go defines 49 function(s): Benchmark_GenericParseTypeBoolean, Benchmark_GenericParseTypeBytes, Benchmark_GenericParseTypeFloats, Benchmark_GenericParseTypeInts, Benchmark_GenericParseTypeString, Benchmark_GenericParseTypeUints, Benchmark_HeaderContainsValue, Benchmark_Utils_GetOffer, Benchmark_Utils_GetSplicedStrList, Benchmark_Utils_IsNoCache, and 39 more.
What does helpers_test.go depend on?
helpers_test.go imports 1 module(s): bytes.
Where is helpers_test.go in the architecture?
helpers_test.go is located at helpers_test.go (domain: FiberCore, subdomain: Routing).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free