MCPcopy
hub / github.com/gofiber/fiber / Test_Integration_Domain_WithCompress

Function Test_Integration_Domain_WithCompress

app_integration_test.go:961–979  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

959}
960
961func 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
981func Test_Integration_Domain_ErrorHandling(t *testing.T) {
982 t.Parallel()

Callers

nothing calls this directly

Calls 8

NewFunction · 0.92
TestMethod · 0.80
NewMethod · 0.65
UseMethod · 0.65
GetMethod · 0.65
DomainMethod · 0.65
SendStringMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected