-
Notifications
You must be signed in to change notification settings - Fork 310
home_work_endpoints #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
home_work_endpoints #211
Conversation
dirtymew
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Привет Ринат
PR нужно оформить в свой форк репозитория - а не репозиторий задания
по работе тоже есть замечания - см PR
precode.go
Outdated
| } | ||
|
|
||
| w.WriteHeader(http.StatusOK) | ||
| w.Write(resp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ , _ = w.Write(resp)
| http.Error(w, "ID задачи обязателен", http.StatusBadRequest) | ||
| return | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут нужно проверить что такой задачи нет в tasks и если есть вернуть ошибку
| return | ||
| } | ||
|
|
||
| if task.ID == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
отлично что добавил эту проверку
precode.go
Outdated
|
|
||
| task, ok := tasks[id] | ||
| if !ok { | ||
| http.Error(w, "Задача не найдена", http.StatusNotFound) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
неверный код ответа - см задание
precode.go
Outdated
|
|
||
| w.Header().Set("Content-Type", "application/json") | ||
| w.WriteHeader(http.StatusCreated) | ||
| resp, err := json.Marshal(task) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
эндпоинт не предполагает возвращение данных - стоит убрать
precode.go
Outdated
|
|
||
| w.Header().Set("Content-Type", "application/json") | ||
| w.WriteHeader(http.StatusOK) | ||
| resp, err := json.Marshal(map[string]string{"message": "Задача удалена"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут тоже не нужно, этого нет в задании
No description provided.