Use generated interface
This commit is contained in:
@ -19,6 +19,15 @@ func (app *application) serverError(w http.ResponseWriter, r *http.Request, err
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
func (app *application) badRequestError(w http.ResponseWriter, r *http.Request, err error) {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
var response = api.ErrorResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
Message: err.Error(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
func (app *application) clientError(w http.ResponseWriter, status int, message string) {
|
||||
w.WriteHeader(status)
|
||||
var response = api.ErrorResponse{
|
||||
|
Reference in New Issue
Block a user