(t *testing.T)
| 2189 | } |
| 2190 | |
| 2191 | func TestDo_httpError(t *testing.T) { |
| 2192 | t.Parallel() |
| 2193 | client, mux, _ := setup(t) |
| 2194 | |
| 2195 | mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { |
| 2196 | http.Error(w, "Bad Request", 400) |
| 2197 | }) |
| 2198 | |
| 2199 | req, _ := client.NewRequest(t.Context(), "GET", ".", nil) |
| 2200 | resp, err := client.Do(req, nil) |
| 2201 | |
| 2202 | if err == nil { |
| 2203 | t.Fatal("Expected HTTP 400 error, got no error.") |
| 2204 | } |
| 2205 | if resp.StatusCode != 400 { |
| 2206 | t.Errorf("Expected HTTP 400 error, got %v status code.", resp.StatusCode) |
| 2207 | } |
| 2208 | } |
| 2209 | |
| 2210 | // Test handling of an error caused by the internal http client's Do() |
| 2211 | // function. A redirect loop is pretty unlikely to occur within the GitHub |
nothing calls this directly
no test coverage detected
searching dependent graphs…