(t *testing.T)
| 2165 | } |
| 2166 | |
| 2167 | func TestDo(t *testing.T) { |
| 2168 | t.Parallel() |
| 2169 | client, mux, _ := setup(t) |
| 2170 | |
| 2171 | type foo struct { |
| 2172 | A string |
| 2173 | } |
| 2174 | |
| 2175 | mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { |
| 2176 | testMethod(t, r, "GET") |
| 2177 | fmt.Fprint(w, `{"A":"a"}`) |
| 2178 | }) |
| 2179 | |
| 2180 | req, _ := client.NewRequest(t.Context(), "GET", ".", nil) |
| 2181 | var body *foo |
| 2182 | _, err := client.Do(req, &body) |
| 2183 | assertNilError(t, err) |
| 2184 | |
| 2185 | want := &foo{"a"} |
| 2186 | if !cmp.Equal(body, want) { |
| 2187 | t.Errorf("Response body = %v, want %v", body, want) |
| 2188 | } |
| 2189 | } |
| 2190 | |
| 2191 | func TestDo_httpError(t *testing.T) { |
| 2192 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…