public void TestRoute(HttpContext context) { string payload = context.Request.Payload.ReadAll(); PathWrapper path = Deserialize <PathWrapper>(payload); if (path == null) { context.Response.Status = HttpStatus.BadRequest; return; } RoutingEntry re = Service.RoutingEngine.GetEntry(path.Method + path.Path); RoutingEntriesWrapper entries = new RoutingEntriesWrapper(); if (re != null) { RoutingEntryWrapper entry = new RoutingEntryWrapper(); entry.Nested = re; entries.RoutingEntries.Add(entry); } string json = Serialize(entries); if (json != null) { context.Response.Payload.Write(json); context.Response.Status = HttpStatus.OK; } else { context.Response.Status = HttpStatus.InternalServerError; } }
public void GetRoutes(HttpContext context) { RoutingEntriesWrapper entries = new RoutingEntriesWrapper(); foreach (RoutingEntry re in Service.RoutingEngine.RoutingEntries.Values) { RoutingEntryWrapper entry = new RoutingEntryWrapper(); entry.Nested = re; entries.RoutingEntries.Add(entry); } string json = Serialize(entries); if (json != null) { context.Response.Payload.Write(json); context.Response.Status = HttpStatus.OK; } else { context.Response.Status = HttpStatus.InternalServerError; } }