File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ async fn api_get_response() -> Result<Response<Body>, GenericError> {
73
73
Ok ( res)
74
74
}
75
75
76
- async fn response_examples ( req : Request < Body > , client : & Client < HttpConnector > )
76
+ async fn response_examples ( req : Request < Body > , client : Client < HttpConnector > )
77
77
-> Result < Response < Body > , GenericError >
78
78
{
79
79
match ( req. method ( ) , req. uri ( ) . path ( ) ) {
@@ -82,7 +82,7 @@ async fn response_examples(req: Request<Body>, client: &Client<HttpConnector>)
82
82
Ok ( Response :: new ( body) )
83
83
} ,
84
84
( & Method :: GET , "/test.html" ) => {
85
- client_request_response ( client) . await
85
+ client_request_response ( & client) . await
86
86
} ,
87
87
( & Method :: POST , "/json_api" ) => {
88
88
api_post_response ( req) . await
@@ -115,7 +115,8 @@ async fn main() -> Result<(), GenericError> {
115
115
let client = client. clone ( ) ;
116
116
async {
117
117
Ok :: < _ , GenericError > ( service_fn ( move |req| {
118
- response_examples ( req, & client)
118
+ // Clone again to ensure that client outlives this closure.
119
+ response_examples ( req, client. to_owned ( ) )
119
120
} ) )
120
121
}
121
122
} ) ;
You can’t perform that action at this time.
0 commit comments