0

I have this use case, where sometimes the code might be partially successful. Can I return the response in such case were I respond with HTTPS-206, saying,"There was an internal server error in following cases."?

Does 206 code spec, specifies not to mention/ does not allow me to mention internal server error in response?

Jeet
  • 85
  • 3
  • 8
  • 1
    The status code 206 (Partial Content) is defined in [RFC 7233](https://www.rfc-editor.org/rfc/rfc7233#section-4.1) if you want to read the definition. – JANO Aug 08 '22 at 14:45

1 Answers1

3

The HTTP 206 status code (like all status codes in the 2xx range) represents "successful" fulfillment of the request, so if you are trying to represent a partial failure, it would probably not be the best choice. 206 is about the response and generally is in response to a request that uses a range header (in other words, a request for only part of a resource). See https://stackoverflow.com/a/55330328/639520 and https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#206_partial_content for more details.

If there has been an error processing the request, you're best to use a 4xx or 5xx response status code, depending on whether the problem stems from client/request data or something truly internal to the server.

E-Riz
  • 31,431
  • 9
  • 97
  • 134