@@ -8,7 +8,7 @@ use crate::{
8
8
} ;
9
9
use http:: {
10
10
header:: { HeaderValue , CONTENT_TYPE , TE } ,
11
- uri:: { Parts , PathAndQuery , Uri } ,
11
+ uri:: { PathAndQuery , Uri } ,
12
12
} ;
13
13
use http_body:: Body ;
14
14
use std:: { fmt, future} ;
@@ -372,13 +372,20 @@ impl GrpcConfig {
372
372
request : Request < BoxBody > ,
373
373
path : PathAndQuery ,
374
374
) -> http:: Request < BoxBody > {
375
- let scheme = self . origin . scheme ( ) . cloned ( ) ;
376
- let authority = self . origin . authority ( ) . cloned ( ) ;
377
-
378
- let mut parts = Parts :: default ( ) ;
379
- parts. path_and_query = Some ( path) ;
380
- parts. scheme = scheme;
381
- parts. authority = authority;
375
+ let mut parts = self . origin . clone ( ) . into_parts ( ) ;
376
+
377
+ match & parts. path_and_query {
378
+ Some ( pnq) if pnq != "/" => {
379
+ parts. path_and_query = Some (
380
+ format ! ( "{}{}" , pnq. path( ) , path)
381
+ . parse ( )
382
+ . expect ( "must form valid path_and_query" ) ,
383
+ )
384
+ }
385
+ _ => {
386
+ parts. path_and_query = Some ( path) ;
387
+ }
388
+ }
382
389
383
390
let uri = Uri :: from_parts ( parts) . expect ( "path_and_query only is valid Uri" ) ;
384
391
0 commit comments