Home / Function/ Test_Compress_Gzip() — fiber Function Reference

Test_Compress_Gzip() — fiber Function Reference

Architecture documentation for the Test_Compress_Gzip() function in compress_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  af05adea_fe14_7201_6dea_9497ba4d4972["Test_Compress_Gzip()"]
  d6d930a5_a4c6_37a5_5df5_4b38486d6fe6["compress_test.go"]
  af05adea_fe14_7201_6dea_9497ba4d4972 -->|defined in| d6d930a5_a4c6_37a5_5df5_4b38486d6fe6
  style af05adea_fe14_7201_6dea_9497ba4d4972 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/compress/compress_test.go lines 35–58

func Test_Compress_Gzip(t *testing.T) {
	t.Parallel()
	app := fiber.New()

	app.Use(New())

	app.Get("/", func(c fiber.Ctx) error {
		c.Set(fiber.HeaderContentType, fiber.MIMETextPlainCharsetUTF8)
		return c.Send(filedata)
	})

	req := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
	req.Header.Set("Accept-Encoding", "gzip")

	resp, err := app.Test(req, testConfig)
	require.NoError(t, err, "app.Test(req)")
	require.Equal(t, 200, resp.StatusCode, "Status code")
	require.Equal(t, "gzip", resp.Header.Get(fiber.HeaderContentEncoding))

	// Validate that the file size has shrunk
	body, err := io.ReadAll(resp.Body)
	require.NoError(t, err)
	require.Less(t, len(body), len(filedata))
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Compress_Gzip() do?
Test_Compress_Gzip() is a function in the fiber codebase, defined in middleware/compress/compress_test.go.
Where is Test_Compress_Gzip() defined?
Test_Compress_Gzip() is defined in middleware/compress/compress_test.go at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free