nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.84k stars 304 forks source link

correct key - HTTP/1.1 200 OK #63

Closed Kozlov-V closed 10 years ago

Kozlov-V commented 11 years ago

Hello! Happy New Year! I wish you success! Do I do not understand. Tell me how to do that properly I would get a HTTP/1.1 200 OK, only on request with the correct key I do so: Console check for entries: # redis-cli keys '*' 1) example: mydata: 558255808376

to make http request: by doing this query: http://192.168.0.90:7379/get/example:data:558255808376 -> response: HTTP/1.1 200 OK

http://192.168.0.90:7379/get/example:data:558255808376 -> HTTP/1.1 304 Not Modified - this is a second request to the existing record but returns a response 304

http://192.168.0.90:7379/get/example:data:558255808376.txt -> response: HTTP/1.1 200 OK

http://192.168.0.90:7379/get/example:data:558255808376.txt11111 -> response: HTTP/1.1 200 OK - we can change arbitrarily, but I still get 200

http://192.168.0.90:7379/get/ -> response: HTTP/1.1 200 OK - it turns out that, in any case, what is the response we get.

I hope that I could understand the idea explained to. Thank you for the answer!

nicolasff commented 11 years ago

Hello,

My apologies for this late reply, but I am currently travelling and do not have access to a unix system to try to reproduce this issue. I guess you must be using a web browser if you get 304s, since they are what is sent if the Etag header matches the old version. You can probably try to disable If-None-Match header that is sent with your requests, but I wouldn't know how to do it. In any case, you should get the right data from the browser cache.

Regards,

Nicolas

Kozlov-V commented 11 years ago

Hello! I wish you a pleasant stay and the outdoors! I myself have not yet come to a definite conclusion, and do a more detailed study. I guess the answers are correct. And in my situation need to analyze the content of <body> in their response. But, I wanted to send a valid key once to get an answer 2xx-OK, but if the key is not correct then any other (4xx, for example). I thought that everything will be easy.))) But, I still spend testing, and will report their findings accurately. Once again, I wish you good mood!

nicolasff commented 11 years ago

Hello,

If I understand correctly, you'd like to receive a 4xx status code if a key doesn't exist? Webdis handles all commands in the same way, and does not treat return values from GET in a special way: as long as Redis returns data, Webdis will return a 200. You can check the type of the reply in the JSON object to know more about what happened.

Nicolas