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

Dependency Diagram

graph TD
  d810c77b_1a4a_b2c5_ac85_e85f3a73e14b["TestPanicWithAbort()"]
  c9a553a7_05a4_91a7_23b0_924f9f59d021["recovery_test.go"]
  d810c77b_1a4a_b2c5_ac85_e85f3a73e14b -->|defined in| c9a553a7_05a4_91a7_23b0_924f9f59d021
  style d810c77b_1a4a_b2c5_ac85_e85f3a73e14b fill:#6366f1,stroke:#818cf8,color:#fff

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

Defined In

Frequently Asked Questions

What does TestPanicWithAbort() do?
TestPanicWithAbort() is a function in the gin codebase, defined in recovery_test.go.
Where is TestPanicWithAbort() defined?
TestPanicWithAbort() is defined in recovery_test.go at line 78.

Analyze Your Own Codebase

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

Try Supermodel Free