adjusting http status code for creation

switch to new lookup implementation
This commit is contained in:
Chris Lu
2012-09-23 15:45:26 -07:00
parent 2002111a80
commit df74f538f7
5 changed files with 28 additions and 160 deletions

View File

@@ -105,12 +105,12 @@ func GetHandler(w http.ResponseWriter, r *http.Request) {
log.Println("read bytes", count, "error", e)
}
if e != nil || count <= 0 {
w.WriteHeader(404)
w.WriteHeader(http.StatusNotFound)
return
}
if n.Cookie != cookie {
log.Println("request with unmaching cookie from ", r.RemoteAddr, "agent", r.UserAgent())
w.WriteHeader(404)
w.WriteHeader(http.StatusNotFound)
return
}
if ext != "" {
@@ -162,6 +162,7 @@ func PostHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Failed to lookup for", volumeId, lookupErr.Error())
}
}
w.WriteHeader(http.StatusCreated)
}
m := make(map[string]uint32)
m["size"] = ret