Home / Function/ TestMiddlewareAbortHandlersChainAndNext() — gin Function Reference

TestMiddlewareAbortHandlersChainAndNext() — gin Function Reference

Architecture documentation for the TestMiddlewareAbortHandlersChainAndNext() function in middleware_test.go from the gin codebase.

Entity Profile

Relationship Graph

Source Code

middleware_test.go lines 185–204

func TestMiddlewareAbortHandlersChainAndNext(t *testing.T) {
	signature := ""
	router := New()
	router.Use(func(c *Context) {
		signature += "A"
		c.Next()
		c.AbortWithStatus(http.StatusGone)
		signature += "B"
	})
	router.GET("/", func(c *Context) {
		signature += "C"
		c.Next()
	})
	// RUN
	w := PerformRequest(router, http.MethodGet, "/")

	// TEST
	assert.Equal(t, http.StatusGone, w.Code)
	assert.Equal(t, "ACB", signature)
}

Domain

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free