14988: Fixes exception raising due to a change in rails5 behavior.
[arvados.git] / sdk / go / httpserver / error.go
index 398e61fcd081097fcdd3b1d79375d5f3347c09ae..1ccf8c04782fbf57aedfe6cb20f75c50ef53cb9d 100644 (file)
@@ -19,3 +19,10 @@ func Error(w http.ResponseWriter, error string, code int) {
        w.WriteHeader(code)
        json.NewEncoder(w).Encode(ErrorResponse{Errors: []string{error}})
 }
+
+func Errors(w http.ResponseWriter, errors []string, code int) {
+       w.Header().Set("Content-Type", "application/json")
+       w.Header().Set("X-Content-Type-Options", "nosniff")
+       w.WriteHeader(code)
+       json.NewEncoder(w).Encode(ErrorResponse{Errors: errors})
+}