Home / Function/ Test_parseCacheControlDirectives_QuotedStrings() — fiber Function Reference

Test_parseCacheControlDirectives_QuotedStrings() — fiber Function Reference

Architecture documentation for the Test_parseCacheControlDirectives_QuotedStrings() function in cache_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  e334ca65_d0cf_55d4_6927_bf3260d10860["Test_parseCacheControlDirectives_QuotedStrings()"]
  8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"]
  e334ca65_d0cf_55d4_6927_bf3260d10860 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656
  style e334ca65_d0cf_55d4_6927_bf3260d10860 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/cache/cache_test.go lines 3640–3740

func Test_parseCacheControlDirectives_QuotedStrings(t *testing.T) {
	t.Parallel()

	tests := []struct {
		name     string
		expected map[string]string
		input    string
	}{
		{
			name:  "simple quoted value",
			input: `community="UCI"`,
			expected: map[string]string{
				"community": "UCI",
			},
		},
		{
			name:  "multiple directives with quoted values",
			input: `max-age=3600, community="UCI", custom="value"`,
			expected: map[string]string{
				"max-age":   "3600",
				"community": "UCI",
				"custom":    "value",
			},
		},
		{
			name:  "quoted value with spaces",
			input: `custom="value with spaces"`,
			expected: map[string]string{
				"custom": "value with spaces",
			},
		},
		{
			name:  "quoted value with escaped quote",
			input: `custom="value with \"quotes\""`,
			expected: map[string]string{
				"custom": `value with "quotes"`,
			},
		},
		{
			name:  "quoted value with escaped backslash",
			input: `custom="value with \\ backslash"`,
			expected: map[string]string{
				"custom": `value with \ backslash`,
			},
		},
		{
			name:  "mixed quoted and unquoted values",
			input: `max-age=3600, community="UCI", no-cache, custom="test"`,
			expected: map[string]string{
				"max-age":   "3600",
				"community": "UCI",
				"no-cache":  "",
				"custom":    "test",
			},
		},
		{
			name:  "quoted empty value",
			input: `custom=""`,
			expected: map[string]string{
				"custom": "",
			},
		},
		{
			name:  "spaces around quoted value",
			input: `custom = "value" , another="test"`,
			expected: map[string]string{
				"custom":  "value",
				"another": "test",
			},
		},
		{
			name:  "unquoted token value",
			input: `max-age=3600`,
			expected: map[string]string{
				"max-age": "3600",
			},
		},
		{
			name:  "complex mixed case",
			input: `max-age=3600, s-maxage=7200, community="UCI", no-store, custom="value with \"escaped\" quotes"`,
			expected: map[string]string{

Subdomains

Frequently Asked Questions

What does Test_parseCacheControlDirectives_QuotedStrings() do?
Test_parseCacheControlDirectives_QuotedStrings() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_parseCacheControlDirectives_QuotedStrings() defined?
Test_parseCacheControlDirectives_QuotedStrings() is defined in middleware/cache/cache_test.go at line 3640.

Analyze Your Own Codebase

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

Try Supermodel Free