- Hands-On RESTful Web Services with TypeScript 3
- Biharck Muniz Araújo
- 134字
- 2021-07-02 12:19:23
HTTP status codes
A huge list of well-defined HTTP status codes exists. This list of commonly used status codes is useful for designing RESTful APIs and leveraging the semantics that are defined for clear communication between producers and consumers.
It is highly recommended to not return a HTTP 200 status for all requests and encode the success or failure of the request in the response body. Keep in mind that there will be a specific HTTP status code for each scenario. Returning the proper status code will indicate the exact behavior that occurred on the server side, which allows the consumer to understand what happened there. There are five high-level HTTP status code classes, as described in the following table:
The following sections describe the most commonly used HTTP status codes in detail.