Test_FiberHandler_WithSendStreamWriter() — fiber Function Reference
Architecture documentation for the Test_FiberHandler_WithSendStreamWriter() function in adaptor_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 9cfc2f52_79f9_3abe_2af7_4057a9593804["Test_FiberHandler_WithSendStreamWriter()"] 8ec96b38_44b4_af66_6f6f_dd60f87b680c["adaptor_test.go"] 9cfc2f52_79f9_3abe_2af7_4057a9593804 -->|defined in| 8ec96b38_44b4_af66_6f6f_dd60f87b680c style 9cfc2f52_79f9_3abe_2af7_4057a9593804 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/adaptor/adaptor_test.go lines 958–986
func Test_FiberHandler_WithSendStreamWriter(t *testing.T) {
t.Parallel()
// Test streaming functionality in FiberHandler using SendStreamWriter.
fiberH := func(c fiber.Ctx) error {
c.Status(fiber.StatusTeapot)
return c.SendStreamWriter(func(w *bufio.Writer) {
w.WriteString("Hello ") //nolint:errcheck // not needed
w.Flush() //nolint:errcheck // not needed
time.Sleep(200 * time.Millisecond) // Simulate a long operation
w.WriteString("World!") //nolint:errcheck // not needed
})
}
handlerFunc := FiberHandlerFunc(fiberH)
r := &http.Request{
Method: http.MethodGet,
RequestURI: "/test",
Header: make(http.Header),
Body: http.NoBody,
}
w := &netHTTPResponseWriter{}
handlerFunc.ServeHTTP(w, r)
// Should return the error status
require.Equal(t, fiber.StatusTeapot, w.StatusCode())
require.Equal(t, "Hello World!", string(w.body))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_FiberHandler_WithSendStreamWriter() do?
Test_FiberHandler_WithSendStreamWriter() is a function in the fiber codebase, defined in middleware/adaptor/adaptor_test.go.
Where is Test_FiberHandler_WithSendStreamWriter() defined?
Test_FiberHandler_WithSendStreamWriter() is defined in middleware/adaptor/adaptor_test.go at line 958.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free