Skip to content

Commit 927b5d8

Browse files
authored
Issue 462/revisit service api (core) design in 0.3 milestone#6 extensions as breadcrumbs (#723)
1 parent 65184a1 commit 927b5d8

File tree

38 files changed

+320
-398
lines changed

38 files changed

+320
-398
lines changed

examples/http_connect_proxy.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ impl UsernameLabelParser for PriorityUsernameLabelParser {
269269
}
270270

271271
fn build(self, ext: &mut Extensions) -> Result<(), Self::Error> {
272-
ext.maybe_insert(self.priority);
272+
if let Some(priority) = self.priority {
273+
ext.insert(priority);
274+
}
275+
273276
Ok(())
274277
}
275278
}

examples/socks5_connect_proxy_over_tls.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
2323
use rama::{
2424
Service,
25-
extensions::ExtensionsMut,
25+
extensions::{ExtensionsMut, ExtensionsRef},
2626
http::{
2727
Body, BodyExtractExt, Request, client::HttpConnector, server::HttpServer,
2828
service::web::Router,
@@ -100,13 +100,16 @@ async fn main() {
100100
});
101101

102102
let EstablishedClientConnection {
103-
req,
103+
mut req,
104104
conn: http_service,
105105
} = client
106106
.connect(request)
107107
.await
108108
.expect("establish a proxied connection ready to make http requests");
109109

110+
req.extensions_mut()
111+
.extend(http_service.extensions().clone());
112+
110113
tracing::info!(
111114
url.full = %uri,
112115
"try to make GET http request and try to receive response text",

0 commit comments

Comments
 (0)