github.com/rpdict/ponzu@v0.10.1-0.20190226054626-477f29d6bf5e/system/api/hide.go (about) 1 package api 2 3 import ( 4 "net/http" 5 6 "github.com/rpdict/ponzu/system/item" 7 ) 8 9 func hide(res http.ResponseWriter, req *http.Request, it interface{}) bool { 10 // check if should be hidden 11 if h, ok := it.(item.Hideable); ok { 12 err := h.Hide(res, req) 13 if err == item.ErrAllowHiddenItem { 14 return false 15 } 16 17 if err != nil { 18 res.WriteHeader(http.StatusInternalServerError) 19 return true 20 } 21 22 res.WriteHeader(http.StatusNotFound) 23 return true 24 } 25 26 return false 27 }