Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public void StartsWithoutError()
        {
            var terra = new TerraServer();

            terra.ListenAsync(8080);
        }