If the search result is empty, it returns 404 response.
If the result of opm search is empty, the response status is 404 and the command result is an error.
# /usr/local/openresty/bin/opm search not-found-keyword
ERROR: failed to search on server: status 404: no search result found.
In this case, I think that the status 200 should be better.
see also:
- http://stackoverflow.com/questions/13366730/proper-rest-response-for-empty-table
- https://benramsey.com/blog/2008/05/http-status-204-no-content-and-205-reset-content/
@tokibito I have a mixed feeling about this. I think a 404 status code would make it much easier and more reliable to check if there is any hits. Otherwise the client has to parse the content to be sure, which is not reliable.
@tokibito Maybe we should change the client instead to handle 404 response for the search command specially?
@agentzh I see. Yes, I agree to change the behavior of the client.
@agentzh Is this resolved?