2XX status code in http

Time:2020-4-28

HTTP status code classification

  • 1XX — message, the server receives the request, and the requester is required to continue the operation
  • 2XX – successful, operation received and processed successfully
  • 3xx — redirect, further action is required to complete the request
  • 4xx — client error, request contains syntax error or cannot complete request
  • 5xx — server error. The server made an error in processing the request

2XX status code

Status code English name Chinese description
200 OK The request is successful. It is usually used for get or post requests.
201 Created Created. Successfully requested and created a new resource.
202 Accepted Accepted. The request was received but not processed.
203 Non-Authoritative Information Unauthorized information. The request succeeds, but the returned meta information is not on the original server, but a copy.
204 No Content No content. The server processed successfully, but did not return content. If the web page is not updated, make sure that the browser does not refresh and continues to display the current document.
205 Reset Content Reset content. The server processing is successful, and the terminal (such as browser) should reset the document view. You can use this return code to clear / reset the form field of the browser.
206 Partial Content Part of the content. The server successfully processed some get requests. It is often used for resuming at breakpoints.

204, 205 use scenarios

  • 204. The response message contains several headers and a status line, but there is no entity content.
    • For some data submitted to the server for processing, 204 can be used as the return information only if the return is successful or not, so as to omit redundant data transmission.
    • Form form submission, a tag and response code 204 will not jump.
  • 205, which tells the browser to clear all HTML form elements in the current page, i.e. form reset, so that the user can input them next time.