(t *testing.T)
| 817 | } |
| 818 | |
| 819 | func TestContext_QueryParams(t *testing.T) { |
| 820 | var testCases = []struct { |
| 821 | expect url.Values |
| 822 | name string |
| 823 | givenURL string |
| 824 | }{ |
| 825 | { |
| 826 | name: "multiple values in url", |
| 827 | givenURL: "/?test=1&test=2&email=jon%40labstack.com", |
| 828 | expect: url.Values{ |
| 829 | "test": []string{"1", "2"}, |
| 830 | "email": []string{"jon@labstack.com"}, |
| 831 | }, |
| 832 | }, |
| 833 | { |
| 834 | name: "single value in url", |
| 835 | givenURL: "/?nope=1", |
| 836 | expect: url.Values{ |
| 837 | "nope": []string{"1"}, |
| 838 | }, |
| 839 | }, |
| 840 | { |
| 841 | name: "no query params in url", |
| 842 | givenURL: "/?", |
| 843 | expect: url.Values{}, |
| 844 | }, |
| 845 | } |
| 846 | |
| 847 | for _, tc := range testCases { |
| 848 | t.Run(tc.name, func(t *testing.T) { |
| 849 | req := httptest.NewRequest(http.MethodGet, tc.givenURL, nil) |
| 850 | e := New() |
| 851 | c := e.NewContext(req, nil) |
| 852 | |
| 853 | assert.Equal(t, tc.expect, c.QueryParams()) |
| 854 | }) |
| 855 | } |
| 856 | } |
| 857 | |
| 858 | func TestContext_QueryParam(t *testing.T) { |
| 859 | var testCases = []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…