(t *testing.T)
| 1082 | } |
| 1083 | |
| 1084 | func Test_FiberHandler_ClosesBodyStream(t *testing.T) { |
| 1085 | t.Parallel() |
| 1086 | |
| 1087 | closed := &atomic.Bool{} |
| 1088 | body := &closeTrackingReader{ |
| 1089 | ReadCloser: io.NopCloser(strings.NewReader("streamed body")), |
| 1090 | closed: closed, |
| 1091 | } |
| 1092 | |
| 1093 | fiberH := func(c fiber.Ctx) error { |
| 1094 | return c.SendStream(body) |
| 1095 | } |
| 1096 | handlerFunc := FiberHandlerFunc(fiberH) |
| 1097 | |
| 1098 | r := httptest.NewRequest(http.MethodGet, "/test", http.NoBody) |
| 1099 | w := httptest.NewRecorder() |
| 1100 | |
| 1101 | handlerFunc.ServeHTTP(w, r) |
| 1102 | require.True(t, closed.Load()) |
| 1103 | } |
| 1104 | |
| 1105 | func Test_FiberHandler_ClosesBodyStreamOnWriteError(t *testing.T) { |
| 1106 | t.Parallel() |
nothing calls this directly
no test coverage detected