File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -337,6 +337,27 @@ func TestInvokes(t *testing.T) {
337
337
},
338
338
options : []Option {},
339
339
},
340
+ {
341
+ name : "WithDisallowUnknownFields(true)" ,
342
+ input : `{"Hello": "World"}` ,
343
+ expected : expected {"" , errors .New (`json: unknown field "Hello"` )},
344
+ handler : func (_ struct {}) {},
345
+ options : []Option {WithDisallowUnknownFields (true )},
346
+ },
347
+ {
348
+ name : "WithDisallowUnknownFields(false)" ,
349
+ input : `{"Hello": "World"}` ,
350
+ expected : expected {`null` , nil },
351
+ handler : func (_ struct {}) {},
352
+ options : []Option {WithDisallowUnknownFields (false )},
353
+ },
354
+ {
355
+ name : "No decoder options provided is the same as WithDisallowUnknownFields(false)" ,
356
+ input : `{"Hello": "World"}` ,
357
+ expected : expected {`null` , nil },
358
+ handler : func (_ struct {}) {},
359
+ options : []Option {},
360
+ },
340
361
{
341
362
name : "bytes are base64 encoded strings" ,
342
363
input : `"aGVsbG8="` ,
You can’t perform that action at this time.
0 commit comments