Browse Source

Merge commit 'a0feeebff658b25dc412049247548276ab964ef5' into HEAD

main
Jenkins 3 years ago
parent
commit
dac474d53d
  1. 6
      controllers/controllers.go

6
controllers/controllers.go

@ -2,12 +2,16 @@ package controllers
import ( import (
"encoding/json" "encoding/json"
"github.com/sirupsen/logrus"
"net/http" "net/http"
) )
func writeError(w http.ResponseWriter, status int, errStr string) { func writeError(w http.ResponseWriter, status int, errStr string) {
w.WriteHeader(status) w.WriteHeader(status)
json.NewEncoder(w).Encode(struct {
err := json.NewEncoder(w).Encode(struct {
Error string `json:"error"` Error string `json:"error"`
}{errStr}) }{errStr})
if err != nil {
logrus.Fatal("Could not write JSON response: ", err)
}
} }
Loading…
Cancel
Save