testFormValues checks that the request form values match the expected values. It expects exactly one value per key.
(t *testing.T, r *http.Request, want values)
| 167 | // testFormValues checks that the request form values match the expected values. |
| 168 | // It expects exactly one value per key. |
| 169 | func testFormValues(t *testing.T, r *http.Request, want values) { |
| 170 | t.Helper() |
| 171 | |
| 172 | wantValues := url.Values{} |
| 173 | for k, v := range want { |
| 174 | wantValues.Add(k, v) |
| 175 | } |
| 176 | |
| 177 | assertNilError(t, r.ParseForm()) |
| 178 | if got := r.Form; !cmp.Equal(got, wantValues) { |
| 179 | t.Errorf("Request query parameters: %v, want %v", got, wantValues) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | // testFormValuesList checks that the request form values match the expected values. |
| 184 | // It allows for multiple values per key. |
no test coverage detected
searching dependent graphs…