Skip to content

Sprint 9 solution http api#6

Merged
dendzim merged 5 commits intomainfrom
sprint_9-solution-http-api
Oct 1, 2025
Merged

Sprint 9 solution http api#6
dendzim merged 5 commits intomainfrom
sprint_9-solution-http-api

Conversation

@dendzim
Copy link
Owner

@dendzim dendzim commented Sep 30, 2025

Реализован функционал согласно ТЗ 9-ого спринта.
Добавлен Http сервер с реализациями обработчиков под разные запросы.
Добавлены тесты для новой функицональности.

import java.io.IOException;
import java.time.Duration;

public class DurationAdapter extends TypeAdapter<java.time.Duration> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.time. лишнее, достаточно того что есть секция import java.time.Duration;


protected void sendNotFound(HttpExchange h) throws IOException {
byte[] resp = "Not Found".getBytes(StandardCharsets.UTF_8);
h.getResponseHeaders().add("Content-Type", "application/json;charset=utf-8");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Т.к. здесь мы отдаем не json а просто текст, то лучше
("Content-Type", "text/plain")


protected void sendHasOverlaps(HttpExchange h) throws IOException {
byte[] resp = "Not Acceptable".getBytes(StandardCharsets.UTF_8);
h.getResponseHeaders().add("Content-Type", "application/json;charset=utf-8");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

См. коммент выше

Copy link

@VadimZharkov VadimZharkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хорошая работа, в целом все верно. Оставил пару уточнений.

@dendzim dendzim merged commit 9f0066f into main Oct 1, 2025
1 check passed
@dendzim dendzim deleted the sprint_9-solution-http-api branch October 1, 2025 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments