(w http.ResponseWriter, r *http.Request)
| 31 | } |
| 32 | |
| 33 | func (mod *RestAPI) setAuthFailed(w http.ResponseWriter, r *http.Request) { |
| 34 | mod.Warning("Unauthorized authentication attempt from %s to %s", r.RemoteAddr, r.URL.String()) |
| 35 | |
| 36 | w.Header().Set("WWW-Authenticate", `Basic realm="auth"`) |
| 37 | w.WriteHeader(401) |
| 38 | w.Write([]byte("Unauthorized")) |
| 39 | } |
| 40 | |
| 41 | func (mod *RestAPI) toJSON(w http.ResponseWriter, o interface{}) { |
| 42 | w.Header().Set("Content-Type", "application/json") |