Home / Function/ Test_Static_Download_NonASCII() — fiber Function Reference

Test_Static_Download_NonASCII() — fiber Function Reference

Architecture documentation for the Test_Static_Download_NonASCII() function in static_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  c548f733_84a5_bd48_dfbf_15d4acb103c2["Test_Static_Download_NonASCII()"]
  f26a2d79_1e01_f027_82eb_45c4308747e8["static_test.go"]
  c548f733_84a5_bd48_dfbf_15d4acb103c2 -->|defined in| f26a2d79_1e01_f027_82eb_45c4308747e8
  style c548f733_84a5_bd48_dfbf_15d4acb103c2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/static/static_test.go lines 223–244

func Test_Static_Download_NonASCII(t *testing.T) {
	// Skip on Windows. It's not possible to delete a file that is in use.
	if runtime.GOOS == "windows" {
		t.SkipNow()
	}

	t.Parallel()

	dir := t.TempDir()
	fname := "файл.txt"
	path := filepath.Join(dir, fname)
	require.NoError(t, os.WriteFile(path, []byte("x"), 0o644)) //nolint:gosec // Not a concern

	app := fiber.New()
	app.Get("/file", New(path, Config{Download: true}))

	resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/file", http.NoBody))
	require.NoError(t, err, "app.Test(req)")
	require.Equal(t, 200, resp.StatusCode, "Status code")
	expect := "attachment; filename=\"" + fname + "\"; filename*=UTF-8''" + url.PathEscape(fname)
	require.Equal(t, expect, resp.Header.Get(fiber.HeaderContentDisposition))
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Static_Download_NonASCII() do?
Test_Static_Download_NonASCII() is a function in the fiber codebase, defined in middleware/static/static_test.go.
Where is Test_Static_Download_NonASCII() defined?
Test_Static_Download_NonASCII() is defined in middleware/static/static_test.go at line 223.

Analyze Your Own Codebase

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

Try Supermodel Free