Skip to content

is possible to apply 'dec.DisallowUnknownFields()' to render.Bind ?Β #50

@angelmotta

Description

@angelmotta

πŸ™‹πŸ»β€β™‚οΈ Hello! I am starting with chi for my personal project. Is there some way to return an error if the received json request has an additional unexpected field?
Using the json.NewDecode(r.body) we can set dec.DisallowUnknownFields() and when we unmarshal the json object via Decode method we get that information error in the err value err := dec.Decode(&someStructType)
I am seeing the chi examples but I don't find examples about it.

Thanks for your assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions