Home / Function/ TestContextNegotiationFormatCustom() — gin Function Reference

TestContextNegotiationFormatCustom() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

context_test.go lines 1779–1790

func TestContextNegotiationFormatCustom(t *testing.T) {
	c, _ := CreateTestContext(httptest.NewRecorder())
	c.Request, _ = http.NewRequest(http.MethodPost, "/", nil)
	c.Request.Header.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9;q=0.8")

	c.Accepted = nil
	c.SetAccepted(MIMEJSON, MIMEXML)

	assert.Equal(t, MIMEJSON, c.NegotiateFormat(MIMEJSON, MIMEXML)) //nolint:testifylint
	assert.Equal(t, MIMEXML, c.NegotiateFormat(MIMEXML, MIMEHTML))
	assert.Equal(t, MIMEJSON, c.NegotiateFormat(MIMEJSON)) //nolint:testifylint
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free