Home / Function/ TestColorForMethod() — gin Function Reference

TestColorForMethod() — gin Function Reference

Architecture documentation for the TestColorForMethod() function in logger_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  013a7556_d013_3522_4e18_6f281fa30195["TestColorForMethod()"]
  9089ba1c_3991_2941_2a87_9934a9e12a6a["logger_test.go"]
  013a7556_d013_3522_4e18_6f281fa30195 -->|defined in| 9089ba1c_3991_2941_2a87_9934a9e12a6a
  style 013a7556_d013_3522_4e18_6f281fa30195 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

logger_test.go lines 287–303

func TestColorForMethod(t *testing.T) {
	colorForMethod := func(method string) string {
		p := LogFormatterParams{
			Method: method,
		}
		return p.MethodColor()
	}

	assert.Equal(t, blue, colorForMethod(http.MethodGet), "get should be blue")
	assert.Equal(t, cyan, colorForMethod(http.MethodPost), "post should be cyan")
	assert.Equal(t, yellow, colorForMethod(http.MethodPut), "put should be yellow")
	assert.Equal(t, red, colorForMethod(http.MethodDelete), "delete should be red")
	assert.Equal(t, green, colorForMethod("PATCH"), "patch should be green")
	assert.Equal(t, magenta, colorForMethod("HEAD"), "head should be magenta")
	assert.Equal(t, white, colorForMethod("OPTIONS"), "options should be white")
	assert.Equal(t, reset, colorForMethod("TRACE"), "trace is not defined and should be the reset color")
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestColorForMethod() do?
TestColorForMethod() is a function in the gin codebase, defined in logger_test.go.
Where is TestColorForMethod() defined?
TestColorForMethod() is defined in logger_test.go at line 287.

Analyze Your Own Codebase

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

Try Supermodel Free