Skip to content

Commit

Permalink
More GitHub Actions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanGiles committed Jan 23, 2024
1 parent ef1c8da commit 5216be4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/net/jonathangiles/tools/teenyhttpd/TeenyHttpd.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void handleIncomingRequest(final Socket clientSocket) {
Map<RequestPath, Function<Request, Response>> methodRoutes = routes.get(method);

// we get request-uri requested. For now we assume it is an absolute path
final String requestUri = parse.nextToken().toLowerCase();
final String requestUri = parse.nextToken();

// split it at the query param, if it exists
final Request request;
Expand Down Expand Up @@ -272,7 +272,10 @@ private void handleIncomingRequest(final Socket clientSocket) {
}
response = route.get().getValue().apply(request);
} else {
response = StatusCode.NO_CONTENT.asResponse();
System.out.println("No route found for " + request.getPath() + " on method " + method);
System.out.println("Available routes are:");
methodRoutes.keySet().forEach(System.out::println);
response = StatusCode.NOT_FOUND.asResponse();
}

sendResponse(clientSocket, response);
Expand Down Expand Up @@ -407,5 +410,14 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(path);
}

@Override
public String toString() {
return "RequestPath{" +
"path='" + path + "'" +
", regexPattern=" + regexPattern +
", pathParams=" + pathParams +
'}';
}
}
}

0 comments on commit 5216be4

Please sign in to comment.