func delete(w http.ResponseWriter, r *http.Request) { parts := strings.Split(r.URL.Path, "/") if len(parts) != 3 { return } if key := parts[1]; key != "" { c := appengine.NewContext(r) blobKey := appengine.BlobKey(key) err := blobstore.Delete(c, blobKey) check(err) err = image.DeleteServingURL(c, blobKey) check(err) } }
func delete(w http.ResponseWriter, r *http.Request) { parts := strings.Split(r.URL.Path, "/") if len(parts) != 3 { return } result := make(map[string]bool, 1) if key := parts[1]; key != "" { c := appengine.NewContext(r) blobKey := appengine.BlobKey(key) err := blobstore.Delete(c, blobKey) check(err) err = image.DeleteServingURL(c, blobKey) check(err) result[key] = true } jsonType := "application/json" if strings.Index(r.Header.Get("Accept"), jsonType) != -1 { w.Header().Set("Content-Type", jsonType) } b, err := json.Marshal(result) check(err) fmt.Fprintln(w, string(b)) }