(t *testing.T)
| 1552 | } |
| 1553 | |
| 1554 | func Test_FiberHandler_WithUnixSocket(t *testing.T) { |
| 1555 | t.Parallel() |
| 1556 | |
| 1557 | // Test case where request has unix socket context |
| 1558 | fiberH := func(c fiber.Ctx) error { |
| 1559 | return c.SendString("unix socket success") |
| 1560 | } |
| 1561 | handlerFunc := FiberHandlerFunc(fiberH) |
| 1562 | |
| 1563 | // Create a context with unix socket local address |
| 1564 | unixAddr := &net.UnixAddr{Name: "/tmp/test.sock", Net: "unix"} |
| 1565 | ctx := context.WithValue(context.Background(), http.LocalAddrContextKey, unixAddr) |
| 1566 | |
| 1567 | r := &http.Request{ |
| 1568 | Method: http.MethodGet, |
| 1569 | RequestURI: "/test", |
| 1570 | RemoteAddr: "someremoteaddr", // This will be ignored due to unix socket |
| 1571 | Header: make(http.Header), |
| 1572 | Body: http.NoBody, |
| 1573 | } |
| 1574 | r = r.WithContext(ctx) |
| 1575 | |
| 1576 | w := &netHTTPResponseWriter{} |
| 1577 | handlerFunc.ServeHTTP(w, r) |
| 1578 | |
| 1579 | require.Equal(t, http.StatusOK, w.StatusCode()) |
| 1580 | require.Equal(t, "unix socket success", string(w.body)) |
| 1581 | } |
| 1582 | |
| 1583 | func Test_FiberHandler_BodySizeLimit(t *testing.T) { |
| 1584 | t.Parallel() |
nothing calls this directly
no test coverage detected