1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
12 type ErrorResponse struct {
13 Errors []string `json:"errors"`
16 func Error(w http.ResponseWriter, error string, code int) {
17 w.Header().Set("Content-Type", "application/json")
18 w.Header().Set("X-Content-Type-Options", "nosniff")
20 json.NewEncoder(w).Encode(ErrorResponse{Errors: []string{error}})