Home / Function/ TestContextNegotiationFormatWithWildcardAccept() — gin Function Reference

TestContextNegotiationFormatWithWildcardAccept() — gin Function Reference

Architecture documentation for the TestContextNegotiationFormatWithWildcardAccept() function in context_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  9dae7a9a_b521_8456_0f56_1beb673473de["TestContextNegotiationFormatWithWildcardAccept()"]
  ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"]
  9dae7a9a_b521_8456_0f56_1beb673473de -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508
  style 9dae7a9a_b521_8456_0f56_1beb673473de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context_test.go lines 1755–1777

func TestContextNegotiationFormatWithWildcardAccept(t *testing.T) {
	c, _ := CreateTestContext(httptest.NewRecorder())
	c.Request, _ = http.NewRequest(http.MethodPost, "/", nil)
	c.Request.Header.Add("Accept", "*/*")

	assert.Equal(t, "*/*", c.NegotiateFormat("*/*"))
	assert.Equal(t, "text/*", c.NegotiateFormat("text/*"))
	assert.Equal(t, "application/*", c.NegotiateFormat("application/*"))
	assert.Equal(t, MIMEJSON, c.NegotiateFormat(MIMEJSON)) //nolint:testifylint
	assert.Equal(t, MIMEXML, c.NegotiateFormat(MIMEXML))
	assert.Equal(t, MIMEHTML, c.NegotiateFormat(MIMEHTML))

	c, _ = CreateTestContext(httptest.NewRecorder())
	c.Request, _ = http.NewRequest(http.MethodPost, "/", nil)
	c.Request.Header.Add("Accept", "text/*")

	assert.Equal(t, "*/*", c.NegotiateFormat("*/*"))
	assert.Equal(t, "text/*", c.NegotiateFormat("text/*"))
	assert.Empty(t, c.NegotiateFormat("application/*"))
	assert.Empty(t, c.NegotiateFormat(MIMEJSON))
	assert.Empty(t, c.NegotiateFormat(MIMEXML))
	assert.Equal(t, MIMEHTML, c.NegotiateFormat(MIMEHTML))
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestContextNegotiationFormatWithWildcardAccept() do?
TestContextNegotiationFormatWithWildcardAccept() is a function in the gin codebase, defined in context_test.go.
Where is TestContextNegotiationFormatWithWildcardAccept() defined?
TestContextNegotiationFormatWithWildcardAccept() is defined in context_test.go at line 1755.

Analyze Your Own Codebase

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

Try Supermodel Free