add logic and unit test for []string type in query params
diff --git a/params_test.go b/params_test.go
index 4a2c9fe..f314a9e 100644
--- a/params_test.go
+++ b/params_test.go
@@ -35,15 +35,17 @@
func TestBuildQueryString(t *testing.T) {
opts := struct {
- J int `q:"j"`
- R string `q:"r,required"`
- C bool `q:"c"`
+ J int `q:"j"`
+ R string `q:"r,required"`
+ C bool `q:"c"`
+ S []string `q:"s"`
}{
J: 2,
R: "red",
C: true,
+ S: []string{"one", "two", "three"},
}
- expected := &url.URL{RawQuery: "c=true&j=2&r=red"}
+ expected := &url.URL{RawQuery: "c=true&j=2&r=red&s=one&s=two&s=three"}
actual, err := BuildQueryString(&opts)
if err != nil {
t.Errorf("Error building query string: %v", err)
@@ -51,9 +53,10 @@
th.CheckDeepEquals(t, expected, actual)
opts = struct {
- J int `q:"j"`
- R string `q:"r,required"`
- C bool `q:"c"`
+ J int `q:"j"`
+ R string `q:"r,required"`
+ C bool `q:"c"`
+ S []string `q:"s"`
}{
J: 2,
C: true,