Incomplete implementation of createVotes
This commit is contained in:
@ -43,6 +43,15 @@ func (app *application) unprocessableEntityError(w http.ResponseWriter, v valida
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
func (app *application) unprocessableEntityErrorSingle(w http.ResponseWriter, err error) {
|
||||
w.WriteHeader(http.StatusUnprocessableEntity)
|
||||
var response = api.ErrorResponse{
|
||||
Code: http.StatusUnprocessableEntity,
|
||||
Message: err.Error(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
func (app *application) unmarshalRequest(r *http.Request, dst any) error {
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user