I'm working on an API, I have a /POST
Method for registration ( /register ) which returns a 200 status code
if OK
or a 401 Unauthorized
in case of a validation error
,
My question is what if my server didn't respond at all? May it return a certain status code
?
What if there is a connection problem on my client side?
There will be some response code that I didn't specify on my back end API
.
So how to deal with those response from the client App?
You always should get a response code. If you don't expect your application to act in a way other than returning 200 or 401, simply present an elagant general error message in case the code is not one of those you expect:
"There might be a problem. Please, try again."