diff --git a/src/view/api.go b/src/view/api.go index 78f48ee..66782dc 100644 --- a/src/view/api.go +++ b/src/view/api.go @@ -94,12 +94,13 @@ func (a *API) getUser() http.HandlerFunc { // @Failure default {object} structs.ANSWERAPI // @Router /user [post] // writeUser gets json request and write to nosql, without id - create new user -// { -// "firstname":"username", -// "lastname":"username", -// "birthday":"1972-06-10", -// "currentlocation":"Location" -// } +// +// { +// "firstname":"username", +// "lastname":"username", +// "birthday":"1972-06-10", +// "currentlocation":"Location" +// } func (a *API) createUser() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var user *structs.USER @@ -251,5 +252,8 @@ func (a *API) respond(w http.ResponseWriter, r *http.Request, code int, data int if r.Method == "OPTIONS" { return } - _ = json.NewEncoder(w).Encode(setAnswer(data, e, add)) + err := json.NewEncoder(w).Encode(setAnswer(data, e, add)) + if err != nil { + return + } }