public bool TryHandle(HttpListenerContext context) { HttpListenerRequest request = context.Request; if (string.Equals(request.HttpMethod, HttpMethod.Method, StringComparison.OrdinalIgnoreCase) && patternMatcher.TryMatch(request.RawUrl, out Dictionary <string, string> placeholderValues)) { EndpointRequestData endpointRequestData = new EndpointRequestData(context, placeholderValues); requestCallback(endpointRequestData); return(true); } return(false); }
private static void DefaultNoEndpointFoundCallback(EndpointRequestData requestData) { requestData.Context.Response.SendResponse("", HttpStatusCode.NotFound); }