(rw http.ResponseWriter, req *http.Request, err error)
| 61 | } |
| 62 | |
| 63 | func ServeError(rw http.ResponseWriter, req *http.Request, err error) { |
| 64 | rw.WriteHeader(http.StatusInternalServerError) |
| 65 | if IsLocalhost(req) || env.IsDev() { |
| 66 | fmt.Fprintf(rw, "Server error: %s\n", err) |
| 67 | return |
| 68 | } |
| 69 | fmt.Fprintf(rw, "An internal error occurred, sorry.") |
| 70 | } |
| 71 | |
| 72 | func ReturnJSON(rw http.ResponseWriter, data interface{}) { |
| 73 | ReturnJSONCode(rw, 200, data) |
no test coverage detected