If the query is empty, should the background return 404 or 200 and then empty the array?

wiki explanation: HTTP 404 or Not Found error message is one of the "standard response messages" (HTTP status codes) of HTTP, which means that the server cannot provide information properly when the client is browsing the web, or the server cannot respond and does not know why. The error message may be confused with "server not found" (the server cannot be found) or other similar information.

If the

query is empty, it is not a query failure, so it should return 200?

Mar.28,2021

pair, return 200, and then give the empty array to the front end. According to the empty array, the front end will tell the user that the queried data list is empty


200, and return empty data, which cannot be 404. If 404 is not necessarily empty data


query is empty, return 200
return 404 will have the possibility of being hijacked


HTTP protocol specification.
is 200 of course, all requests are successful!
you can learn about the HTTP protocol specification, which is very good.


http authoritative Guide


200. The server accepts the client's request, but the requested resource exists

.
Menu