What should a JSON service return on failure / error

后端 未结 11 1119
温柔的废话
温柔的废话 2020-12-02 05:32

I\'m writing a JSON service in C# (.ashx file). On a successful request to the service I return some JSON data. If the request fails, either because an exception was thrown

11条回答
  •  粉色の甜心
    2020-12-02 06:27

    If the user supplies invalid data, it should definitely be a 400 Bad Request (The request contains bad syntax or cannot be fulfilled.)

提交回复
热议问题