From 2eaf0e534c2c24df56c23ed247b61d81affb6f67 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Thu, 3 Nov 2016 01:11:24 -0700 Subject: adding catch for api handler to check if type exists and throw 404 if not --- system/api/handlers.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'system/api/handlers.go') diff --git a/system/api/handlers.go b/system/api/handlers.go index d1758f0..afe5819 100644 --- a/system/api/handlers.go +++ b/system/api/handlers.go @@ -92,6 +92,11 @@ func postHandler(res http.ResponseWriter, req *http.Request) { id := q.Get("id") t := q.Get("type") + if _, ok := content.Types[t]; !ok { + res.WriteHeader(http.StatusNotFound) + return + } + if t == "" || id == "" { res.WriteHeader(http.StatusBadRequest) return -- cgit v1.2.3