Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: Update binder in form_test #3336

Merged
merged 3 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion binder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Fiber provides several default binders out of the box:

### Binding into a Struct

Fiber supports binding request data directly into a struct using [gorilla/schema](https://github.com/gorilla/schema). Here's an example:
Fiber supports binding request data directly into a struct using [gofiber/schema](https://github.com/gofiber/schema). Here's an example:

```go
// Field names must start with an uppercase letter
Expand Down
10 changes: 5 additions & 5 deletions binder/form_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ func Benchmark_FormBinder_Bind(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

binder := &QueryBinding{
binder := &FormBinding{
EnableSplitting: true,
}

type User struct {
Name string `query:"name"`
Posts []string `query:"posts"`
Age int `query:"age"`
Name string `form:"name"`
Posts []string `form:"posts"`
Age int `form:"age"`
}
var user User

req := fasthttp.AcquireRequest()
req.URI().SetQueryString("name=john&age=42&posts=post1,post2,post3")
req.SetBodyString("name=john&age=42&posts=post1,post2,post3")
req.Header.SetContentType("application/x-www-form-urlencoded")

b.ResetTimer()
Expand Down
2 changes: 1 addition & 1 deletion binder/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func parse(aliasTag string, out any, data map[string][]string, files ...map[stri
return parseToStruct(aliasTag, out, data, files...)
}

// Parse data into the struct with gorilla/schema
// Parse data into the struct with gofiber/schema
func parseToStruct(aliasTag string, out any, data map[string][]string, files ...map[string][]*multipart.FileHeader) error {
// Get decoder from pool
schemaDecoder := decoderPoolMap[aliasTag].Get().(*schema.Decoder) //nolint:errcheck,forcetypeassert // not needed
Expand Down
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
ErrNoHandlers = errors.New("format: at least one handler is required, but none were set")
)

// gorilla/schema errors
// gofiber/schema errors
type (
// ConversionError Conversion error exposes the internal schema.ConversionError for public use.
ConversionError = schema.ConversionError
Expand Down
Loading