Provision the response for a json payload.
(w http.ResponseWriter, code int, data interface{})
| 56 | |
| 57 | // Provision the response for a json payload. |
| 58 | func jsonResponse(w http.ResponseWriter, code int, data interface{}) { |
| 59 | w.Header().Set("Content-Type", "application/json") |
| 60 | w.WriteHeader(code) |
| 61 | json.NewEncoder(w).Encode(data) |
| 62 | } |
| 63 | |
| 64 | // Remove all files in array. This is used to clean up something that went |
| 65 | // wrong. |