What HTTP Status Codes Should Programmers be Concerned With?

前端 未结 6 1820
半阙折子戏
半阙折子戏 2021-02-03 11:06

So, if you look at the List of HTTP Status Codes, there are probably a number of them that would be useful while programming. The server might handle some things, like protocols

6条回答
  •  长情又很酷
    2021-02-03 11:28

    I take it your talking about using headers for either serving files or providing a RESTful webservice?

    You'd be after status codes, rather than headers then. The ones I've commonly used are:

    200 OK
    301 Moved Permanently
    302 Found (temporary redirect)
    400 Bad Request
    403 Forbidden
    404 Not found
    500 Internal Server Error
    

    Of course, for RESTful webservices you can change the text to be more descriptive as well as providing description in the body.

    Then there's:

    418 I'm a teapot
    

提交回复
热议问题