Test_Bind_SkipValidation_Usage() — fiber Function Reference
Architecture documentation for the Test_Bind_SkipValidation_Usage() function in bind_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 98facb2e_d1f4_a93a_9886_829f6d847f8b["Test_Bind_SkipValidation_Usage()"] 55065b01_f5dc_4e53_5a74_5ecc7aca8f52["bind_test.go"] 98facb2e_d1f4_a93a_9886_829f6d847f8b -->|defined in| 55065b01_f5dc_4e53_5a74_5ecc7aca8f52 style 98facb2e_d1f4_a93a_9886_829f6d847f8b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
bind_test.go lines 1965–2025
func Test_Bind_SkipValidation_Usage(t *testing.T) {
t.Parallel()
app := New(Config{StructValidator: &structValidator{}})
t.Run("skip validation for json", func(t *testing.T) {
t.Parallel()
c := app.AcquireCtx(&fasthttp.RequestCtx{})
t.Cleanup(func() {
app.ReleaseCtx(c)
})
body := []byte(`{"name":"efe"}`)
c.Request().SetBody(body)
c.Request().Header.SetContentType(MIMEApplicationJSON)
c.Request().Header.SetContentLength(len(body))
req := new(simpleQuery)
require.NoError(t, c.Bind().SkipValidation(true).JSON(req))
require.Equal(t, "efe", req.Name)
})
t.Run("re-enable validation explicitly", func(t *testing.T) {
t.Parallel()
c := app.AcquireCtx(&fasthttp.RequestCtx{})
t.Cleanup(func() {
app.ReleaseCtx(c)
})
body := []byte(`{"name":"efe"}`)
c.Request().SetBody(body)
c.Request().Header.SetContentType(MIMEApplicationJSON)
c.Request().Header.SetContentLength(len(body))
req := new(simpleQuery)
require.EqualError(t, c.Bind().SkipValidation(false).JSON(req), "you should have entered right name")
})
t.Run("toggle on same bind instance", func(t *testing.T) {
c := app.AcquireCtx(&fasthttp.RequestCtx{})
t.Cleanup(func() {
app.ReleaseCtx(c)
})
body := []byte(`{"name":"efe"}`)
c.Request().SetBody(body)
c.Request().Header.SetContentType(MIMEApplicationJSON)
c.Request().Header.SetContentLength(len(body))
req := new(simpleQuery)
require.NoError(t, c.Bind().SkipValidation(true).JSON(req))
c.Request().SetBody(body)
c.Request().Header.SetContentType(MIMEApplicationJSON)
c.Request().Header.SetContentLength(len(body))
req = new(simpleQuery)
require.EqualError(t, c.Bind().SkipValidation(false).JSON(req), "you should have entered right name")
})
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_Bind_SkipValidation_Usage() do?
Test_Bind_SkipValidation_Usage() is a function in the fiber codebase, defined in bind_test.go.
Where is Test_Bind_SkipValidation_Usage() defined?
Test_Bind_SkipValidation_Usage() is defined in bind_test.go at line 1965.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free