Home > database >  Can you specify error with HTTPS-206 response?
Can you specify error with HTTPS-206 response?

Time:08-09

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?

CodePudding user response:

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.

  • Related