From 5ea44107d0814516b0922735dd52c08c4d77d3f1 Mon Sep 17 00:00:00 2001 From: ^_^void Date: Tue, 25 Feb 2020 09:42:14 +0800 Subject: [PATCH] add unit test for AllParams() add unit test for AllParams() --- context_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/context_test.go b/context_test.go index 051a93a..130e0f7 100644 --- a/context_test.go +++ b/context_test.go @@ -171,6 +171,18 @@ func Test_Context(t *testing.T) { So(resp.Body.String(), ShouldEqual, "user user 1 13 1.24 ") }) + Convey("All Parameter", func() { + m.Get("/:arg/:param/:flag", func(ctx *Context) string { + return com.ToStr(len(ctx.AllParams())) + }) + + resp := httptest.NewRecorder() + req, err := http.NewRequest("GET", "/arg/param/flag", nil) + So(err, ShouldBeNil) + m.ServeHTTP(resp,req) + So(resp.Body.String(), ShouldEqual, "3") + }) + Convey("Get file", func() { m.Post("/getfile", func(ctx *Context) { ctx.Query("")