File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -2034,10 +2034,16 @@ impl SenderBuilder {
2034
2034
#[ cfg( feature = "ilp-over-http" ) ]
2035
2035
/// Additional time to wait on top of that calculated from the minimum throughput.
2036
2036
/// This accounts for the fixed latency of the HTTP request-response roundtrip.
2037
- /// The value is in milliseconds, and the default is 10 seconds.
2037
+ /// The default is 10 seconds.
2038
2038
/// See also: [`request_min_throughput`](SenderBuilder::request_min_throughput).
2039
2039
pub fn request_timeout ( mut self , value : Duration ) -> Result < Self > {
2040
2040
if let Some ( http) = & mut self . http {
2041
+ if value. is_zero ( ) {
2042
+ return Err ( error:: fmt!(
2043
+ ConfigError ,
2044
+ "\" request_timeout\" must be greater than 0."
2045
+ ) ) ;
2046
+ }
2041
2047
http. request_timeout
2042
2048
. set_specified ( "request_timeout" , value) ?;
2043
2049
} else {
Original file line number Diff line number Diff line change @@ -128,6 +128,21 @@ fn incomplete_basic_auth() {
128
128
) ;
129
129
}
130
130
131
+ #[ cfg( feature = "ilp-over-http" ) ]
132
+ #[ test]
133
+ fn zero_timeout_forbidden ( ) {
134
+ assert_conf_err (
135
+ SenderBuilder :: from_conf ( "http::addr=localhost;username=user123;request_timeout=0;" ) ,
136
+ "\" request_timeout\" must be greater than 0." ,
137
+ ) ;
138
+
139
+ assert_conf_err (
140
+ SenderBuilder :: new ( Protocol :: Http , "localhost" , 9000 )
141
+ . request_timeout ( Duration :: from_millis ( 0 ) ) ,
142
+ "\" request_timeout\" must be greater than 0." ,
143
+ ) ;
144
+ }
145
+
131
146
#[ cfg( feature = "ilp-over-http" ) ]
132
147
#[ test]
133
148
fn misspelled_basic_auth ( ) {
You can’t perform that action at this time.
0 commit comments