MCPcopy
hub / github.com/gofiber/fiber / Test_SetParserDecoder_UnknownKeys

Function Test_SetParserDecoder_UnknownKeys

binder/binder_test.go:114–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

112}
113
114func Test_SetParserDecoder_UnknownKeys(t *testing.T) {
115 SetParserDecoder(ParserConfig{IgnoreUnknownKeys: false})
116 defer SetParserDecoder(ParserConfig{IgnoreUnknownKeys: true, ZeroEmpty: true})
117 type user struct {
118 Name string `query:"name"`
119 }
120 data := map[string][]string{"name": {"john"}, "foo": {"bar"}}
121 err := parseToStruct("query", &user{}, data)
122 require.Error(t, err)
123 SetParserDecoder(ParserConfig{IgnoreUnknownKeys: true, ZeroEmpty: true})
124}
125
126func Test_SetParserDecoder_CustomConverter(t *testing.T) {
127 type myInt int

Callers

nothing calls this directly

Calls 3

SetParserDecoderFunction · 0.85
parseToStructFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected