Test_App_Mixed_Routes_WithSameLen() — fiber Function Reference
Architecture documentation for the Test_App_Mixed_Routes_WithSameLen() function in app_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 3516c005_3b4b_8967_316c_23ab27999843["Test_App_Mixed_Routes_WithSameLen()"] e728fdd2_242f_706b_c1d2_041b3d6badb5["app_test.go"] 3516c005_3b4b_8967_316c_23ab27999843 -->|defined in| e728fdd2_242f_706b_c1d2_041b3d6badb5 style 3516c005_3b4b_8967_316c_23ab27999843 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
app_test.go lines 1615–1659
func Test_App_Mixed_Routes_WithSameLen(t *testing.T) {
t.Parallel()
app := New()
// middleware
app.Use(func(c Ctx) error {
c.Set("TestHeader", "TestValue")
return c.Next()
})
// routes with the same length
app.Get("/tesbar", func(c Ctx) error {
c.Type("html")
return c.Send([]byte("TEST_BAR"))
})
app.Get("/foobar", func(c Ctx) error {
c.Type("html")
return c.Send([]byte("FOO_BAR"))
})
// match get route
req := httptest.NewRequest(MethodGet, "/foobar", http.NoBody)
resp, err := app.Test(req)
require.NoError(t, err, "app.Test(req)")
require.Equal(t, 200, resp.StatusCode, "Status code")
require.NotEmpty(t, resp.Header.Get(HeaderContentLength))
require.Equal(t, "TestValue", resp.Header.Get("TestHeader"))
require.Equal(t, "text/html; charset=utf-8", resp.Header.Get(HeaderContentType))
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "FOO_BAR", string(body))
// match static route
req = httptest.NewRequest(MethodGet, "/tesbar", http.NoBody)
resp, err = app.Test(req)
require.NoError(t, err, "app.Test(req)")
require.Equal(t, 200, resp.StatusCode, "Status code")
require.NotEmpty(t, resp.Header.Get(HeaderContentLength))
require.Equal(t, "TestValue", resp.Header.Get("TestHeader"))
require.Equal(t, "text/html; charset=utf-8", resp.Header.Get(HeaderContentType))
body, err = io.ReadAll(resp.Body)
require.NoError(t, err)
require.Contains(t, string(body), "TEST_BAR")
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_App_Mixed_Routes_WithSameLen() do?
Test_App_Mixed_Routes_WithSameLen() is a function in the fiber codebase, defined in app_test.go.
Where is Test_App_Mixed_Routes_WithSameLen() defined?
Test_App_Mixed_Routes_WithSameLen() is defined in app_test.go at line 1615.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free