Home / Function/ TestPanicWithAbort() — gin Function Reference

TestPanicWithAbort() — gin Function Reference

Architecture documentation for the TestPanicWithAbort() function in recovery_test.go from the gin codebase.

Entity Profile

Relationship Graph

Source Code

recovery_test.go lines 78–89

func TestPanicWithAbort(t *testing.T) {
	router := New()
	router.Use(RecoveryWithWriter(nil))
	router.GET("/recovery", func(c *Context) {
		c.AbortWithStatus(http.StatusBadRequest)
		panic("Oupps, Houston, we have a problem")
	})
	// RUN
	w := PerformRequest(router, http.MethodGet, "/recovery")
	// TEST
	assert.Equal(t, http.StatusBadRequest, w.Code)
}

Domain

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free