(t *testing.T)
| 1065 | } |
| 1066 | |
| 1067 | func Test_Integration_Domain_CaseInsensitiveMatching(t *testing.T) { |
| 1068 | t.Parallel() |
| 1069 | |
| 1070 | app := fiber.New() |
| 1071 | |
| 1072 | app.Domain("API.Example.COM").Get("/", func(c fiber.Ctx) error { |
| 1073 | return c.SendString("matched") |
| 1074 | }) |
| 1075 | |
| 1076 | // Test various case combinations |
| 1077 | hosts := []string{ |
| 1078 | "api.example.com", |
| 1079 | "API.EXAMPLE.COM", |
| 1080 | "Api.Example.Com", |
| 1081 | "aPi.eXaMpLe.CoM", |
| 1082 | } |
| 1083 | |
| 1084 | for _, host := range hosts { |
| 1085 | t.Run(host, func(t *testing.T) { |
| 1086 | t.Parallel() |
| 1087 | req := httptest.NewRequest(http.MethodGet, "/", http.NoBody) |
| 1088 | req.Host = host |
| 1089 | resp, err := app.Test(req) |
| 1090 | require.NoError(t, err) |
| 1091 | require.Equal(t, fiber.StatusOK, resp.StatusCode) |
| 1092 | body, err := io.ReadAll(resp.Body) |
| 1093 | require.NoError(t, err) |
| 1094 | require.Equal(t, "matched", string(body)) |
| 1095 | }) |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | func Test_Integration_Domain_ReusableSubApp(t *testing.T) { |
| 1100 | t.Parallel() |
nothing calls this directly
no test coverage detected