What Is a 205 Status Code?
The server has fulfilled the request and desires that the user agent reset the “document view”, which caused the request to be sent, to its original state as received from the origin server.
This response is intended to support a common data entry use case where the user receives content that supports data entry (a form, notepad, canvas, etc.), enters or manipulates data in that space, causes the entered data to be submitted in a request, and then the data entry mechanism is reset for the next entry so that the user can easily initiate another input action.
Since the 205 status code implies that no additional content will be provided, a server MUST NOT generate a payload in a 205 response. In other words, a server MUST do one of the following for a 205 response: a) indicate a zero-length body for the response by including a Content-Length header field with a value of 0; b) indicate a zero-length payload for the response by including a Transfer-Encoding header field with a value of chunked and a message body consisting of a single chunk of zero-length; or, c) close the connection immediately after sending the blank line terminating the header section.
- Source: RFC7231 Section 6.3.6
205 CODE REFERENCES
Rails HTTP Status Symbol
Go HTTP Status Constant
Symfony HTTP Status Constant
Python2 HTTP Status Constant
Python3+ HTTP Status Constant
Python3.5+ HTTP Status Constant
When should a 205 status code get used?
Use the 205 status code when there is zero content to return to the client, like:
- When a client sends a request to delete a resource, and the resource has been deleted, the server responds with a 205 status code.
- When a client sends a request to reset a form, and the server has reset the form, the server responds with a 205 status code.
In these cases, there is no content to return to the client, so the 205 status code signals to the client that the request was successful.
What is the difference between the 205 status code and the 200 status code?
The 200 status code means the server has successfully processed the client’s request and is returning a response with a message body. In contrast, the 205 status code means the server has successfully processed the request but has no message body to return.
What is the difference between the 205 status code and the 204 status code?
The 204 status code means the server has successfully processed the request and is returning a response with no message body. However, the 204 status code does not provide information on whether the client should take further action. The 205 status code tells the client the request was successful and that there is no content to show for it.
3+ best practices for 205 status codes
Follow these best practices to use the 205 status code effectively:
- Use the 205 status code only when necessary: The 205 status code should be used only when there is no content to return to the client. If there is content to return, use a different status code, like 200 or 204.
- Provide a clear explanation: If you use the 205 status code, provide a clear explanation in the response header about why there is no content to return.
- Avoid the 205 status code for POST requests: The 205 status code is not ideal for POST requests. If you need to indicate success for a POST request, use a different status code, like 200 or 201.
- Handle the 205 status code properly on the client side: When a client receives a 205 status code, it should not expect content in the response body. The client should handle the response.
Help! I have a 205 status code error
Here are some steps you can take to troubleshoot a 205 status code error:
- Verify the request method: Check that the client’s request method is appropriate for the resource being accessed. The 205 status code is not applicable to all HTTP methods. For example, it is not applicable to POST requests.
- Check the response headers: Check the response headers to ensure that they are well-formed and accurate. Verify the server has sent a 205 status code in response to the client’s request.
- Inspect the response body: Since the 205 status code indicates there is no content to return, the response body should be empty. If the response body contains unexpected content, it could hint at an issue with the server’s response.
- Verify the server configuration: Check the server’s configuration to ensure it’s set up correctly. This could include verifying the server is configured to handle the appropriate HTTP methods and that there are no errors in the server configuration.
- Check for network issues: Network issues can cause HTTP errors, including the 205 status code. Verify there are no network issues, such as connectivity problems or firewalls blocking the request.
- Debug the client-side code: Check that the client-side code is handling the 205 status code correctly and confirm it’s not expecting content in the response body.
- Learn about web development
- Learn about SEO
- Web development services from WebFX
- Small business SEO services from WebFX
- MDN Web Docs