mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-17 16:26:47 +03:00
Create done channel in fakeServer during the initialization of newRequestCtx to prevent the done channel from being nil
This commit is contained in:
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user