| 959 | } |
| 960 | |
| 961 | func Test_Integration_Domain_WithCompress(t *testing.T) { |
| 962 | t.Parallel() |
| 963 | |
| 964 | app := fiber.New() |
| 965 | app.Use(compress.New()) |
| 966 | |
| 967 | app.Domain("api.example.com").Get("/data", func(c fiber.Ctx) error { |
| 968 | // Return large enough content for compression |
| 969 | return c.SendString(strings.Repeat("Hello World! ", 100)) |
| 970 | }) |
| 971 | |
| 972 | req := httptest.NewRequest(http.MethodGet, "/data", http.NoBody) |
| 973 | req.Host = "api.example.com" |
| 974 | req.Header.Set(fiber.HeaderAcceptEncoding, "gzip") |
| 975 | resp, err := app.Test(req) |
| 976 | require.NoError(t, err) |
| 977 | require.Equal(t, fiber.StatusOK, resp.StatusCode) |
| 978 | require.Equal(t, "gzip", resp.Header.Get(fiber.HeaderContentEncoding)) |
| 979 | } |
| 980 | |
| 981 | func Test_Integration_Domain_ErrorHandling(t *testing.T) { |
| 982 | t.Parallel() |