Skip to content
Myr

Adjust the position of some functions (#3385)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Heliner · committed by GitHub · parent 97082f8 · Browse files · 1 file+8 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: fredhan <fredhan@futunn.com>

Diff stats

1 file+8 added−8 removed

  • other:+8 added−8 removed

1 file+8 added−8 removed

modified:binding/toml.go+8 added-8 removed
16 unmodified lines
17func (tomlBinding) Name() string {18 return "toml"19}2021func decodeToml(r io.Reader, obj any) error {22 decoder := toml.NewDecoder(r)23 if err := decoder.Decode(obj); err != nil {24 return err25 }26 return decoder.Decode(obj)27}2821func (tomlBinding) Bind(req *http.Request, obj any) error {22 return decodeToml(req.Body, obj)23}2425func (tomlBinding) BindBody(body []byte, obj any) error {26 return decodeToml(bytes.NewReader(body), obj)27}2829func decodeToml(r io.Reader, obj any) error {30 decoder := toml.NewDecoder(r)31 if err := decoder.Decode(obj); err != nil {32 return err33 }34 return decoder.Decode(obj)35}