Home / Function/ TestMiddlewareFailHandlersChain() — gin Function Reference

TestMiddlewareFailHandlersChain() — gin Function Reference

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

Entity Profile

Relationship Graph

Source Code

middleware_test.go lines 208–227

func TestMiddlewareFailHandlersChain(t *testing.T) {
	// SETUP
	signature := ""
	router := New()
	router.Use(func(context *Context) {
		signature += "A"
		context.AbortWithError(http.StatusInternalServerError, errors.New("foo")) //nolint: errcheck
	})
	router.Use(func(context *Context) {
		signature += "B"
		context.Next()
		signature += "C"
	})
	// RUN
	w := PerformRequest(router, http.MethodGet, "/")

	// TEST
	assert.Equal(t, http.StatusInternalServerError, w.Code)
	assert.Equal(t, "A", signature)
}

Domain

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free