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

The error response for a request with malformed JSON body provides too little information #1434

Closed
bajtos opened this issue Jun 14, 2018 · 0 comments · Fixed by #1598
Closed
Labels
bug developer-experience Issues affecting ease of use and overall experience of LB users

Comments

@bajtos
Copy link
Member

bajtos commented Jun 14, 2018

Description / Steps to reproduce / Feature proposal

  1. Start examples/todo

  2. Execute the following request (notice the extra comma before closing }):

    curl -X POST "http://127.0.0.1:3000/todos" -H "accept: */*" \
      -H "Content-Type: application/json" \
      -d "{ \"title\": \"foo\", \"desc\": \"bar\", \"isComplete\": false,}"
    

Current Behavior

The server returns error response with body {"statusCode": 400}

Expected Behavior

The error response body should provide information necessary to troubleshoot the issue. At minimum, it should say that the request body contained malformed JSON.

Without that, client developers have no idea how to fix the problem.

Additional information

Ideally, error responses should contain a single top-level error property that contains an object with additional details. This makes it easier to consume the response in places where the response body is available only (no access to response status code).

I personally think we should leverage strong-error-handler module, it handles security considerations needed for production and was already verified by real world usage in LB 3.x applications.

See Reporting Issues for more tips on writing good issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug developer-experience Issues affecting ease of use and overall experience of LB users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants