@@ -352,10 +352,30 @@ func WithInterceptors(interceptors ...Interceptor) Option {
352352 return & interceptorsOption {interceptors }
353353}
354354
355+ // WithReadTimeout option specifies the maximum amount of time that a service
356+ // handler is allowed to take when reading a message in a stream.
357+ // If the total time exceeds WithReadTimeout, then that particular stream is
358+ // closed.
359+ // This enables the user to close only that particular stream instead of the
360+ // entire connection.
361+ // This prevents malicious or slow clients from using up resources.
362+ // This option is passed to the handler config and then to the spec.
363+ // Finally, ServeHTTP function of the handler reads the timeout values from
364+ // the spec and enforces them using ResponseController.
355365func WithReadTimeout (value time.Duration ) HandlerOption {
356366 return & readTimeoutOption {value : value }
357367}
358368
369+ // WithWriteTimeout option specifies the maximum amount of time that a service
370+ // handler is allowed to take when writing a message to a stream.
371+ // If the total time exceeds WithReadTimeout, then that particular stream is
372+ // closed.
373+ // This enables the user to close only that particular stream instead of the
374+ // entire connection.
375+ // This prevents malicious or slow clients from using up resources.
376+ // This option is passed to the handler config and then to the spec.
377+ // Finally, ServeHTTP function of the handler reads the timeout values from
378+ // the spec and enforces them using ResponseController.
359379func WithWriteTimeout (value time.Duration ) HandlerOption {
360380 return & writeTimeoutOption {value : value }
361381}
0 commit comments