public async Task CheckGet() { var terra = new TerraServer(); terra.Get("/test", async ctx => { await ctx.Response.WriteAsync("Test"); }); await terra.ListenAsync(8081); var client = new WebClient(); var resp = await client.DownloadStringTaskAsync("http://localhost:8081/test"); Assert.Equal("Test", resp); }
public async Task Run() { var terra = new TerraServer(); terra.Get("/", async ctx => { await ctx.Response.WriteAsync("Get received"); }); terra.Post("/post", async ctx => { var param = ctx.Request.Form["Hello"]; await ctx.Response.WriteAsync(param); }); await terra.ListenAsync(8080); await Task.Delay(-1); }
public void StartsWithoutError() { var terra = new TerraServer(); terra.ListenAsync(8080); }