diff --git a/Tranga/Server.cs b/Tranga/Server.cs index 17c2d2a..aa6aea2 100644 --- a/Tranga/Server.cs +++ b/Tranga/Server.cs @@ -68,7 +68,7 @@ public partial class Server : GlobalBase if (request.Url!.LocalPath.Contains("favicon")) SendResponse(HttpStatusCode.NoContent, response); - if (Regex.IsMatch(request.Url.LocalPath, "")) + if (Regex.IsMatch(request.Url.LocalPath, "/v2(/.*)?")) { HandleRequestV2(context); return; diff --git a/Tranga/ServerV2.cs b/Tranga/ServerV2.cs index 48a11a2..092a8cb 100644 --- a/Tranga/ServerV2.cs +++ b/Tranga/ServerV2.cs @@ -18,30 +18,27 @@ public partial class Server ValueTuple responseMessage = request.HttpMethod switch { - "GET" => HandleGetV2(path, response, requestParams), - "POST" => HandlePostV2(path, response, requestParams), - "DELETE" => HandleDeleteV2(path, response, requestParams), + "GET" => HandleGetV2(path, requestParams), + "POST" => HandlePostV2(path, requestParams), + "DELETE" => HandleDeleteV2(path, requestParams), _ => new ValueTuple(HttpStatusCode.MethodNotAllowed, null) }; SendResponse(responseMessage.Item1, response, responseMessage.Item2); } - private ValueTuple HandleGetV2(string path, HttpListenerResponse response, - Dictionary requestParameters) + private ValueTuple HandleGetV2(string path, Dictionary requestParameters) { - throw new NotImplementedException("v2 not implemented yet"); + return new ValueTuple(HttpStatusCode.NotImplemented, "Not implemented."); } - private ValueTuple HandlePostV2(string path, HttpListenerResponse response, - Dictionary requestParameters) + private ValueTuple HandlePostV2(string path, Dictionary requestParameters) { - throw new NotImplementedException("v2 not implemented yet"); + return new ValueTuple(HttpStatusCode.NotImplemented, "Not implemented."); } - private ValueTuple HandleDeleteV2(string path, HttpListenerResponse response, - Dictionary requestParameters) + private ValueTuple HandleDeleteV2(string path, Dictionary requestParameters) { - throw new NotImplementedException("v2 not implemented yet"); + return new ValueTuple(HttpStatusCode.NotImplemented, "Not implemented."); } } \ No newline at end of file