Skip to content

Commit

Permalink
Changed response of io/subjects or io/teachers to 200 and empty array…
Browse files Browse the repository at this point in the history
… instead of 404 error response
  • Loading branch information
srideep-banerjee committed Apr 10, 2024
1 parent 3311ffd commit 4ccee1e
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/main/java/org/example/network/ApiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ public void handle(HttpExchange exchange) {
} else if (path.equals("/io/teachers")) {
switch (requestMethod) {
case "GET" -> {
if (TeacherDao.getInstance().isEmpty()) {
sendTextResponse(exchange, 404, "No teachers found");
return;
}
try {
String response = objectMapper.writeValueAsString(TeacherDao.getInstance());
sendJsonResponse(exchange, 200, response);
Expand Down Expand Up @@ -168,10 +164,6 @@ public void handle(HttpExchange exchange) {
} else if (path.equals("/io/subjects")) {
switch (requestMethod) {
case "GET" -> {
if (SubjectDao.getInstance().isEmpty()) {
sendTextResponse(exchange, 404, "No subjects found");
return;
}
try {
String response = objectMapper.writeValueAsString(SubjectDao.getInstance());
sendJsonResponse(exchange, 200, response);
Expand Down

0 comments on commit 4ccee1e

Please sign in to comment.