diff --git a/lib/go/camli/httputil/httputil.go b/lib/go/camli/httputil/httputil.go index a0c3926d2..8928027fd 100644 --- a/lib/go/camli/httputil/httputil.go +++ b/lib/go/camli/httputil/httputil.go @@ -30,12 +30,24 @@ func ErrorRouting(conn http.ResponseWriter, req *http.Request) { log.Printf("Internal routing error on %q", req.URL.Path) } -func BadRequestError(conn http.ResponseWriter, errorMessage string) { +func BadRequestError(conn http.ResponseWriter, errorMessage string, args ...interface{}) { conn.WriteHeader(http.StatusBadRequest) - log.Printf("Bad request: %s", errorMessage) + log.Printf("Bad request: %s", fmt.Sprintf(errorMessage, args...)) fmt.Fprintf(conn, "%s\n", errorMessage) } +func ForbiddenError(conn http.ResponseWriter, errorMessage string, args ...interface{}) { + conn.WriteHeader(http.StatusForbidden) + log.Printf("Forbidden: %s", fmt.Sprintf(errorMessage, args...)) + fmt.Fprintf(conn, "