Home / Function/ Test_Utils_SortAcceptedTypes() — fiber Function Reference

Test_Utils_SortAcceptedTypes() — fiber Function Reference

Architecture documentation for the Test_Utils_SortAcceptedTypes() function in helpers_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  59d0a312_6cbb_939a_bbf5_f0e969f47546["Test_Utils_SortAcceptedTypes()"]
  c82e3595_b1b8_f596_c097_f26fa40159d1["helpers_test.go"]
  59d0a312_6cbb_939a_bbf5_f0e969f47546 -->|defined in| c82e3595_b1b8_f596_c097_f26fa40159d1
  style 59d0a312_6cbb_939a_bbf5_f0e969f47546 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

helpers_test.go lines 536–567

func Test_Utils_SortAcceptedTypes(t *testing.T) {
	t.Parallel()
	acceptedTypes := []acceptedType{
		{spec: "text/html", quality: 1, specificity: 3, order: 0},
		{spec: "text/*", quality: 0.5, specificity: 2, order: 1},
		{spec: "*/*", quality: 0.1, specificity: 1, order: 2},
		{spec: "application/xml", quality: 1, specificity: 3, order: 4},
		{spec: "application/pdf", quality: 1, specificity: 3, order: 5},
		{spec: "image/png", quality: 1, specificity: 3, order: 6},
		{spec: "image/jpeg", quality: 1, specificity: 3, order: 7},
		{spec: "image/*", quality: 1, specificity: 2, order: 8},
		{spec: "image/gif", quality: 1, specificity: 3, order: 9},
		{spec: "text/plain", quality: 1, specificity: 3, order: 10},
		{spec: "application/json", quality: 0.999, specificity: 3, params: headerParams{"a": []byte("1")}, order: 11},
		{spec: "application/json", quality: 0.999, specificity: 3, order: 3},
	}
	sortAcceptedTypes(acceptedTypes)
	require.Equal(t, []acceptedType{
		{spec: "text/html", quality: 1, specificity: 3, order: 0},
		{spec: "application/xml", quality: 1, specificity: 3, order: 4},
		{spec: "application/pdf", quality: 1, specificity: 3, order: 5},
		{spec: "image/png", quality: 1, specificity: 3, order: 6},
		{spec: "image/jpeg", quality: 1, specificity: 3, order: 7},
		{spec: "image/gif", quality: 1, specificity: 3, order: 9},
		{spec: "text/plain", quality: 1, specificity: 3, order: 10},
		{spec: "image/*", quality: 1, specificity: 2, order: 8},
		{spec: "application/json", quality: 0.999, specificity: 3, params: headerParams{"a": []byte("1")}, order: 11},
		{spec: "application/json", quality: 0.999, specificity: 3, order: 3},
		{spec: "text/*", quality: 0.5, specificity: 2, order: 1},
		{spec: "*/*", quality: 0.1, specificity: 1, order: 2},
	}, acceptedTypes)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_Utils_SortAcceptedTypes() do?
Test_Utils_SortAcceptedTypes() is a function in the fiber codebase, defined in helpers_test.go.
Where is Test_Utils_SortAcceptedTypes() defined?
Test_Utils_SortAcceptedTypes() is defined in helpers_test.go at line 536.

Analyze Your Own Codebase

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

Try Supermodel Free