Commit 7c4834d 1 parent 61df5c9 commit 7c4834d Copy full SHA for 7c4834d
File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,15 @@ impl Checker {
37
37
let mut retries: u64 = 0 ;
38
38
let mut wait_time = self . retry_wait_time ;
39
39
40
- let mut status = self . check_default ( request . try_clone ( ) . unwrap ( ) ) . await ; // TODO: try_clone
40
+ let mut status = self . check_default ( clone_unwrap ( & request ) ) . await ;
41
41
while retries < self . max_retries {
42
42
if status. is_success ( ) || !status. should_retry ( ) {
43
43
return status;
44
44
}
45
45
retries += 1 ;
46
46
tokio:: time:: sleep ( wait_time) . await ;
47
47
wait_time = wait_time. saturating_mul ( 2 ) ;
48
- status = self . check_default ( request . try_clone ( ) . unwrap ( ) ) . await ; // TODO: try_clone
48
+ status = self . check_default ( clone_unwrap ( & request ) ) . await ;
49
49
}
50
50
status
51
51
}
@@ -59,6 +59,12 @@ impl Checker {
59
59
}
60
60
}
61
61
62
+ /// SAFETY: unwrapping the `try_clone` of `reqwest::Request` is safe because a request only fails to be cloned when `body` of `Request` is a stream
63
+ /// and `body` cannot be a stream as long as the `stream` feature is disabled.
64
+ fn clone_unwrap ( request : & Request ) -> Request {
65
+ request. try_clone ( ) . unwrap ( )
66
+ }
67
+
62
68
#[ async_trait]
63
69
impl Chainable < Request , Status > for Checker {
64
70
async fn chain ( & mut self , input : Request ) -> ChainResult < Request , Status > {
You can’t perform that action at this time.
0 commit comments