using Nancy;

namespace TinyClient.Tests.Helpers
{
    public class TestEndpoint : NancyModule
    {
        public RouteBuilder Trace => new RouteBuilder("TRACE", this);

        public TestEndpoint()
        {
            Get["/echo"] = _ => Response.AsJson(new TestResponse { Method = "Get" });
            Post["/echo"] = _ => Response.AsJson(new TestResponse { Method = "Post" });
            Put["/echo"] = _ => Response.AsJson(new TestResponse { Method = "Put" });
            Delete["/echo"] = _ => Response.AsJson(new TestResponse { Method = "Delete" });
            Options["/echo"] = _ => Response.AsJson(new TestResponse { Method = "Options" });
            Head["/echo"] = _ =>
            {
                var r = new Response();
                r.Headers.Add("Method", "Head");
                return r;
            };
            Trace["/echo"] = _ => Response.AsJson(new TestResponse { Method = "Trace" });
            Patch["/echo"] = _ => Response.AsJson(new TestResponse { Method = "Patch" });
        }

    }
}