MCPcopy
hub / github.com/gin-gonic/gin / TestValidationFails

Function TestValidationFails

binding/binding_test.go:750–755  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

748}
749
750func TestValidationFails(t *testing.T) {
751 var obj FooStruct
752 req := requestWithBody(http.MethodPost, "/", `{"bar": "foo"}`)
753 err := JSON.Bind(req, &obj)
754 require.Error(t, err)
755}
756
757func TestValidationDisabled(t *testing.T) {
758 backup := Validator

Callers

nothing calls this directly

Calls 3

requestWithBodyFunction · 0.85
BindMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected