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

Function TestRequiredSucceeds

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

Source from the content-addressed store, hash-verified

766}
767
768func TestRequiredSucceeds(t *testing.T) {
769 type HogeStruct struct {
770 Hoge *int `json:"hoge" binding:"required"`
771 }
772
773 var obj HogeStruct
774 req := requestWithBody(http.MethodPost, "/", `{"hoge": 0}`)
775 err := JSON.Bind(req, &obj)
776 require.NoError(t, err)
777}
778
779func TestRequiredFails(t *testing.T) {
780 type HogeStruct struct {

Callers

nothing calls this directly

Calls 2

requestWithBodyFunction · 0.85
BindMethod · 0.65

Tested by

no test coverage detected