MCPcopy
hub / github.com/gin-gonic/gin / TestContextWithFallbackDoneFromRequestContext

Function TestContextWithFallbackDoneFromRequestContext

context_test.go:3151–3167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3149}
3150
3151func TestContextWithFallbackDoneFromRequestContext(t *testing.T) {
3152 c, _ := CreateTestContext(httptest.NewRecorder())
3153 // enable ContextWithFallback feature flag
3154 c.engine.ContextWithFallback = true
3155
3156 assert.Nil(t, c.Done())
3157
3158 c2, _ := CreateTestContext(httptest.NewRecorder())
3159 // enable ContextWithFallback feature flag
3160 c2.engine.ContextWithFallback = true
3161
3162 c2.Request, _ = http.NewRequest(http.MethodGet, "/", nil)
3163 ctx, cancel := context.WithCancel(context.Background())
3164 c2.Request = c2.Request.WithContext(ctx)
3165 cancel()
3166 assert.NotNil(t, <-c2.Done())
3167}
3168
3169func TestContextWithFallbackErrFromRequestContext(t *testing.T) {
3170 c, _ := CreateTestContext(httptest.NewRecorder())

Callers

nothing calls this directly

Calls 2

CreateTestContextFunction · 0.85
DoneMethod · 0.80

Tested by

no test coverage detected