Home / Function/ TestContextWithFallbackDeadlineFromRequestContext() — gin Function Reference

TestContextWithFallbackDeadlineFromRequestContext() — gin Function Reference

Architecture documentation for the TestContextWithFallbackDeadlineFromRequestContext() function in context_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  51f06753_57f2_bb82_ecea_5a04660d02a2["TestContextWithFallbackDeadlineFromRequestContext()"]
  ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"]
  51f06753_57f2_bb82_ecea_5a04660d02a2 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508
  style 51f06753_57f2_bb82_ecea_5a04660d02a2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context_test.go lines 3117–3138

func TestContextWithFallbackDeadlineFromRequestContext(t *testing.T) {
	c, _ := CreateTestContext(httptest.NewRecorder())
	// enable ContextWithFallback feature flag
	c.engine.ContextWithFallback = true

	deadline, ok := c.Deadline()
	assert.Zero(t, deadline)
	assert.False(t, ok)

	c2, _ := CreateTestContext(httptest.NewRecorder())
	// enable ContextWithFallback feature flag
	c2.engine.ContextWithFallback = true

	c2.Request, _ = http.NewRequest(http.MethodGet, "/", nil)
	d := time.Now().Add(time.Second)
	ctx, cancel := context.WithDeadline(context.Background(), d)
	defer cancel()
	c2.Request = c2.Request.WithContext(ctx)
	deadline, ok = c2.Deadline()
	assert.Equal(t, d, deadline)
	assert.True(t, ok)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestContextWithFallbackDeadlineFromRequestContext() do?
TestContextWithFallbackDeadlineFromRequestContext() is a function in the gin codebase, defined in context_test.go.
Where is TestContextWithFallbackDeadlineFromRequestContext() defined?
TestContextWithFallbackDeadlineFromRequestContext() is defined in context_test.go at line 3117.

Analyze Your Own Codebase

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

Try Supermodel Free