Feature Proposal Description
Add options object for active the DisallowUnknownFields in the BodyParser for more strict parsing to a struct in cases where is required.
Alignment with Express API
BodyParser middleware for JSON in express permit you to add different options that affect the parsing
HTTP RFC Standards Compliance
Confirmed
API Stability
DisallowUnknownFields is a native functions of the Decoder from native Go package json
Feature Examples
type Cat struct {
Name
}
POST /cats
{
“Name”: “lasagna”
“Age”: 3
}
Response:
Error the request body not match exactly the struct of Cat
p := new(Person)
if err := c.BodyParser(p,Options{DisallowUnknownFields:true}); err != nil {
return err
}
Checklist:
Feature Proposal Description
Add options object for active the DisallowUnknownFields in the BodyParser for more strict parsing to a struct in cases where is required.
Alignment with Express API
BodyParser middleware for JSON in express permit you to add different options that affect the parsing
HTTP RFC Standards Compliance
Confirmed
API Stability
DisallowUnknownFields is a native functions of the Decoder from native Go package
jsonFeature Examples
Checklist: