diff --git a/server.go b/server.go index 8cd6fef5f8..bcf30cb9e3 100644 --- a/server.go +++ b/server.go @@ -2789,6 +2789,7 @@ func (ctx *RequestCtx) Value(key any) any { } var fakeServer = &Server{ + done: make(chan struct{}), // Initialize concurrencyCh for TimeoutHandler concurrencyCh: make(chan struct{}, DefaultConcurrency), } diff --git a/server_test.go b/server_test.go index 75ea137db6..59f27d1ada 100644 --- a/server_test.go +++ b/server_test.go @@ -4414,3 +4414,13 @@ func TestRequestBodyStreamReadIssue1816(t *testing.T) { t.Fatal(err) } } + +func TestRequestCtxInitShouldNotBeCanceledIssue1879(t *testing.T) { + var r Request + var requestCtx RequestCtx + requestCtx.Init(&r, nil, nil) + err := requestCtx.Err() + if err != nil { + t.Fatal(err) + } +}