File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -256,10 +256,11 @@ func NewBidiStreamHandler[Req, Res any](
256256
257257// ServeHTTP implements [http.Handler].
258258func (h * Handler ) ServeHTTP (responseWriter http.ResponseWriter , request * http.Request ) {
259-
260- rc := http .NewResponseController (responseWriter )
261- rc .SetReadDeadline (time .Now ().Add (time .Duration (h .spec .ReadTimeout ) * time .Nanosecond ))
262- rc .SetWriteDeadline (time .Now ().Add (time .Duration (h .spec .ReadTimeout ) * time .Nanosecond ))
259+ if h .spec .ReadTimeout != 0 {
260+ rc := http .NewResponseController (responseWriter )
261+ rc .SetReadDeadline (time .Now ().Add (time .Duration (h .spec .ReadTimeout ) * time .Nanosecond ))
262+ rc .SetWriteDeadline (time .Now ().Add (time .Duration (h .spec .ReadTimeout ) * time .Nanosecond ))
263+ }
263264
264265 // We don't need to defer functions to close the request body or read to
265266 // EOF: the stream we construct later on already does that, and we only
You can’t perform that action at this time.
0 commit comments