Implement simple client
This commit is contained in:
@@ -32,14 +32,14 @@ func (s *Server) CatchAll(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *Server) get(w http.ResponseWriter, r *http.Request) {
|
||||
config := config.Values()
|
||||
key := strings.Split(r.URL.Path, "/")[1]
|
||||
if v, err := config.DB.Get(key); err == storage.ErrNotFound {
|
||||
if value, err := config.DB.Get(key); err == storage.ErrNotFound {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
} else if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
} else {
|
||||
w.Write(v)
|
||||
w.Write(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user