Home / Function/ Test_Group_Use_StrictRoutingBoundary() — fiber Function Reference

Test_Group_Use_StrictRoutingBoundary() — fiber Function Reference

Architecture documentation for the Test_Group_Use_StrictRoutingBoundary() function in router_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  9d4f727d_8428_dabd_ec14_1b2e56070fbc["Test_Group_Use_StrictRoutingBoundary()"]
  326d7e00_9e4f_d854_0c78_b9c0c93e5537["router_test.go"]
  9d4f727d_8428_dabd_ec14_1b2e56070fbc -->|defined in| 326d7e00_9e4f_d854_0c78_b9c0c93e5537
  style 9d4f727d_8428_dabd_ec14_1b2e56070fbc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

router_test.go lines 1107–1198

func Test_Group_Use_StrictRoutingBoundary(t *testing.T) {
	type testCase struct {
		name           string
		path           string
		expectedStatus int
		strictRouting  bool
		expectMatched  bool
	}

	testCases := []testCase{
		{
			name:           "Strict group exact match",
			strictRouting:  true,
			path:           "/api/v1",
			expectMatched:  true,
			expectedStatus: StatusOK,
		},
		{
			name:           "Strict group trailing slash partial",
			strictRouting:  true,
			path:           "/api/v1/",
			expectMatched:  true,
			expectedStatus: StatusOK,
		},
		{
			name:           "Strict group nested partial",
			strictRouting:  true,
			path:           "/api/v1/users",
			expectMatched:  true,
			expectedStatus: StatusOK,
		},
		{
			name:           "Strict group disallows sibling prefix",
			strictRouting:  true,
			path:           "/api/v1beta",
			expectMatched:  false,
			expectedStatus: StatusNotFound,
		},
		{
			name:           "Non-strict group exact match",
			strictRouting:  false,
			path:           "/api/v1",
			expectMatched:  true,
			expectedStatus: StatusOK,
		},
		{
			name:           "Non-strict group trailing slash partial",
			strictRouting:  false,
			path:           "/api/v1/",
			expectMatched:  true,
			expectedStatus: StatusOK,
		},
		{
			name:           "Non-strict group nested partial",
			strictRouting:  false,
			path:           "/api/v1/users",
			expectMatched:  true,
			expectedStatus: StatusOK,
		},
		{
			name:           "Non-strict group disallows sibling prefix",
			strictRouting:  false,
			path:           "/api/v1beta",
			expectMatched:  false,
			expectedStatus: StatusNotFound,
		},
	}

	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			app := New(Config{StrictRouting: tt.strictRouting})

			grp := app.Group("/api")
			matched := false
			grp.Use("/v1", func(c Ctx) error {
				matched = true
				return c.Next()
			})
			grp.Get("/v1", func(c Ctx) error {
				return c.SendStatus(StatusOK)
			})

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_Group_Use_StrictRoutingBoundary() do?
Test_Group_Use_StrictRoutingBoundary() is a function in the fiber codebase, defined in router_test.go.
Where is Test_Group_Use_StrictRoutingBoundary() defined?
Test_Group_Use_StrictRoutingBoundary() is defined in router_test.go at line 1107.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free