binder_test.go — fiber Source File
Architecture documentation for binder_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 85091b00_b20b_efcc_56f1_31b94278fe54["binder_test.go"] a13b8bb1_d603_cd28_c9dc_32f76c8f8637["multipart"] 85091b00_b20b_efcc_56f1_31b94278fe54 --> a13b8bb1_d603_cd28_c9dc_32f76c8f8637 style 85091b00_b20b_efcc_56f1_31b94278fe54 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package binder
import (
"mime/multipart"
"reflect"
"strconv"
"testing"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_GetAndPutToThePool(t *testing.T) {
t.Parallel()
// Panics in case we get from another pool
require.Panics(t, func() {
_ = GetFromThePool[*HeaderBinding](&CookieBinderPool)
})
// We get from the pool
binder := GetFromThePool[*HeaderBinding](&HeaderBinderPool)
PutToThePool(&HeaderBinderPool, binder)
_ = GetFromThePool[*RespHeaderBinding](&RespHeaderBinderPool)
_ = GetFromThePool[*QueryBinding](&QueryBinderPool)
_ = GetFromThePool[*FormBinding](&FormBinderPool)
_ = GetFromThePool[*URIBinding](&URIBinderPool)
_ = GetFromThePool[*XMLBinding](&XMLBinderPool)
_ = GetFromThePool[*JSONBinding](&JSONBinderPool)
_ = GetFromThePool[*CBORBinding](&CBORBinderPool)
_ = GetFromThePool[*MsgPackBinding](&MsgPackBinderPool)
}
func Test_Binders_ErrorPaths(t *testing.T) {
t.Run("query binder invalid key", func(t *testing.T) {
b := &QueryBinding{}
req := fasthttp.AcquireRequest()
req.URI().SetQueryString("invalid[%3Dval&name=john")
defer fasthttp.ReleaseRequest(req)
err := b.Bind(req, &struct{}{})
require.Error(t, err)
require.Contains(t, err.Error(), "unmatched brackets")
})
t.Run("form binder invalid key", func(t *testing.T) {
b := &FormBinding{}
req := fasthttp.AcquireRequest()
req.SetBodyString("invalid[=val")
req.Header.SetContentType("application/x-www-form-urlencoded")
defer fasthttp.ReleaseRequest(req)
err := b.Bind(req, &struct{}{})
require.Error(t, err)
require.Contains(t, err.Error(), "unmatched brackets")
})
t.Run("form binder bad multipart", func(t *testing.T) {
b := &FormBinding{}
req := fasthttp.AcquireRequest()
req.Header.SetContentType(MIMEMultipartForm)
// ... (94 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- multipart
Source
Frequently Asked Questions
What does binder_test.go do?
binder_test.go is a source file in the fiber codebase, written in go. It belongs to the DataBinding domain, Extractors subdomain.
What functions are defined in binder_test.go?
binder_test.go defines 8 function(s): Test_Binders_ErrorPaths, Test_GetAndPutToThePool, Test_GetFieldCache_Panic, Test_SetParserDecoder_CustomConverter, Test_SetParserDecoder_UnknownKeys, Test_formatBindData_typeMismatch, Test_parseToMap_defaultCase, Test_parse_function_maps.
What does binder_test.go depend on?
binder_test.go imports 1 module(s): multipart.
Where is binder_test.go in the architecture?
binder_test.go is located at binder/binder_test.go (domain: DataBinding, subdomain: Extractors, directory: binder).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free