opm icon indicating copy to clipboard operation
opm copied to clipboard

If the search result is empty, it returns 404 response.

Open tokibito opened this issue 8 years ago • 4 comments

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 avatar May 16 '17 06:05 tokibito

@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.

agentzh avatar May 16 '17 18:05 agentzh

@tokibito Maybe we should change the client instead to handle 404 response for the search command specially?

agentzh avatar May 16 '17 18:05 agentzh

@agentzh I see. Yes, I agree to change the behavior of the client.

tokibito avatar May 16 '17 18:05 tokibito

@agentzh Is this resolved?

tokibito avatar Jan 16 '21 15:01 tokibito