Home / Function/ TestRouteNotAllowedEnabled() — gin Function Reference

TestRouteNotAllowedEnabled() — gin Function Reference

Architecture documentation for the TestRouteNotAllowedEnabled() function in routes_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  6eb3d3af_7841_a90c_b40c_e566c80aad9c["TestRouteNotAllowedEnabled()"]
  69c2add5_555a_3d82_a4e7_993886631a2c["PerformRequest()"]
  6eb3d3af_7841_a90c_b40c_e566c80aad9c -->|calls| 69c2add5_555a_3d82_a4e7_993886631a2c
  style 6eb3d3af_7841_a90c_b40c_e566c80aad9c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

routes_test.go lines 493–506

func TestRouteNotAllowedEnabled(t *testing.T) {
	router := New()
	router.HandleMethodNotAllowed = true
	router.POST("/path", func(c *Context) {})
	w := PerformRequest(router, http.MethodGet, "/path")
	assert.Equal(t, http.StatusMethodNotAllowed, w.Code)

	router.NoMethod(func(c *Context) {
		c.String(http.StatusTeapot, "responseText")
	})
	w = PerformRequest(router, http.MethodGet, "/path")
	assert.Equal(t, "responseText", w.Body.String())
	assert.Equal(t, http.StatusTeapot, w.Code)
}

Domain

Subdomains

Frequently Asked Questions

What does TestRouteNotAllowedEnabled() do?
TestRouteNotAllowedEnabled() is a function in the gin codebase.
What does TestRouteNotAllowedEnabled() call?
TestRouteNotAllowedEnabled() calls 1 function(s): PerformRequest.

Analyze Your Own Codebase

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

Try Supermodel Free