Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Errors on JSON Decodes, in server-side API handlers #70

Closed
jhunt opened this issue Jan 28, 2016 · 0 comments
Closed

Check Errors on JSON Decodes, in server-side API handlers #70

jhunt opened this issue Jan 28, 2016 · 0 comments

Comments

@jhunt
Copy link
Contributor

jhunt commented Jan 28, 2016

We have code like this all over:

var params struct {
  /* some structure def */
}
json.NewDecoder(req.Body).Decode(&params)

// use `params`, without checking for bad JSON formatting, non-JSON input, etc.

We should handle errors from the JSON decoder, as 400 Bad Requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant