(t *testing.T)
| 2956 | } |
| 2957 | |
| 2958 | func Test_App_Test_response_error(t *testing.T) { |
| 2959 | // Note: Test cannot run in parallel due to |
| 2960 | // overriding the httpReadResponse global variable. |
| 2961 | // t.Parallel() |
| 2962 | |
| 2963 | // Override httpReadResponse temporarily |
| 2964 | oldHTTPReadResponse := httpReadResponse |
| 2965 | defer func() { |
| 2966 | httpReadResponse = oldHTTPReadResponse |
| 2967 | }() |
| 2968 | httpReadResponse = func(_ *bufio.Reader, _ *http.Request) (*http.Response, error) { |
| 2969 | return nil, errErrorReader |
| 2970 | } |
| 2971 | |
| 2972 | app := New() |
| 2973 | app.Get("/", func(c Ctx) error { |
| 2974 | return c.SendStatus(StatusOK) |
| 2975 | }) |
| 2976 | |
| 2977 | _, err := app.Test(httptest.NewRequest(MethodGet, "/", http.NoBody), TestConfig{ |
| 2978 | Timeout: 0, |
| 2979 | FailOnTimeout: false, |
| 2980 | }) |
| 2981 | require.ErrorIs(t, err, errErrorReader) |
| 2982 | } |
| 2983 | |
| 2984 | type errorReadCloser int |
| 2985 |
nothing calls this directly
no test coverage detected