diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-03 01:11:24 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-03 01:11:24 -0700 |
commit | 2eaf0e534c2c24df56c23ed247b61d81affb6f67 (patch) | |
tree | 7edf8977b698b866d03051ce918d0c9e2b1e9577 /system/api/handlers.go | |
parent | 515473bdcd15e706b2927ff150d2fbee7fa321d3 (diff) |
adding catch for api handler to check if type exists and throw 404 if not
Diffstat (limited to 'system/api/handlers.go')
-rw-r--r-- | system/api/handlers.go | 5 |
1 files changed, 5 insertions, 0 deletions
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 |