package route import ( "net/http" "git.1e99.eu/1e99/passed/password" ) func HasPassword(storage password.Storage) http.HandlerFunc { return func(res http.ResponseWriter, req *http.Request) { id := req.PathValue("id") _, err := storage.Get(id) switch { case err == password.ErrNotFound: http.Error(res, "", http.StatusNotFound) return case err != nil: http.Error(res, "", http.StatusInternalServerError) return } res.WriteHeader(http.StatusNoContent) } }