(t *testing.T)
| 1002 | } |
| 1003 | |
| 1004 | func Test_FiberHandler_IOError(t *testing.T) { |
| 1005 | t.Parallel() |
| 1006 | |
| 1007 | // Test io.Copy error by using a failing reader |
| 1008 | fiberH := func(c fiber.Ctx) error { |
| 1009 | return c.SendString("should not reach here") |
| 1010 | } |
| 1011 | handlerFunc := FiberHandlerFunc(fiberH) |
| 1012 | |
| 1013 | // Create a reader that fails |
| 1014 | failingReader := &failingReader{} |
| 1015 | |
| 1016 | r := &http.Request{ |
| 1017 | Method: http.MethodPost, |
| 1018 | RequestURI: "/test", |
| 1019 | Body: failingReader, |
| 1020 | ContentLength: 100, // Set content length so it tries to read |
| 1021 | Header: make(http.Header), |
| 1022 | } |
| 1023 | |
| 1024 | w := &netHTTPResponseWriter{} |
| 1025 | handlerFunc.ServeHTTP(w, r) |
| 1026 | |
| 1027 | // Should return 500 due to io.Copy error |
| 1028 | require.Equal(t, http.StatusInternalServerError, w.StatusCode()) |
| 1029 | } |
| 1030 | |
| 1031 | func Test_FiberHandler_WithErrorInHandler(t *testing.T) { |
| 1032 | t.Parallel() |
nothing calls this directly
no test coverage detected