Add check for exact path match

HttpExchange just checks startsWith, so would also match /api/v1/rpcfoobar
This commit is contained in:
AsamK 2022-11-02 21:17:28 +01:00
parent 0c4642aa20
commit 36abb8ae8f

View file

@ -66,6 +66,10 @@ public class HttpServerHandler {
}
private void handleRpcEndpoint(HttpExchange httpExchange) throws IOException {
if (!"/api/v1/rpc".equals(httpExchange.getRequestURI().getPath())) {
sendResponse(404, null, httpExchange);
return;
}
if (!"POST".equals(httpExchange.getRequestMethod())) {
sendResponse(405, null, httpExchange);
return;