diff options
Diffstat (limited to 'api/api.go')
| -rw-r--r-- | api/api.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -88,7 +88,13 @@ func HandleItem(w http.ResponseWriter, r *http.Request) { jsonError(w, "invalid json", http.StatusBadRequest) return } - i.Id = id + if i.Id == 0 { + i.Id = id + } + if i.Id != id { + jsonError(w, "id mismatch", http.StatusBadRequest) + return + } i.Save() jsonResponse(w, i) @@ -150,6 +156,10 @@ func HandleFeed(w http.ResponseWriter, r *http.Request) { jsonError(w, "invalid json", http.StatusBadRequest) return } + if f.Id == 0 { + jsonError(w, "missing feed id", http.StatusBadRequest) + return + } f.Update() jsonResponse(w, f) |
