且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用HTTP状态codeS反映的Web服务请求成功/失败?

更新时间:2022-05-23 21:40:01

http状态code只是用于指示应用程序响应的状态。 正如你所说,如果JSON参数,不知何故无效,400状态code 一个合适的答案。

http status code are just for indicating the status of the application response. and as you said, if json parameters as somehow invalid, a 400 status code is an appropriate answer.

所以是的,它是使用HTTP状态code一个很好的主意。德加,状态code是那么容易理解,因为他们没有从应用程序到另一个改变(网络服务)

so yes, it is a really good idea to use http status code. de plus, status code are then easy to understand as they don't change from an application (web services) to another