@@ -441,7 +441,7 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
441441 . method ( http_method)
442442 . uri ( {
443443 let host = headers. get ( http:: header:: HOST ) . and_then ( |val| val. to_str ( ) . ok ( ) ) ;
444- match host {
444+ let mut uri = match host {
445445 Some ( host) => {
446446 format ! (
447447 "{}://{}{}" ,
@@ -454,7 +454,17 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
454454 )
455455 }
456456 None => path. to_string ( ) ,
457+ } ;
458+
459+ if !multi_value_query_string_parameters. is_empty ( ) {
460+ uri. push ( '?' ) ;
461+ uri. push_str ( multi_value_query_string_parameters. to_query_string ( ) . as_str ( ) ) ;
462+ } else if !query_string_parameters. is_empty ( ) {
463+ uri. push ( '?' ) ;
464+ uri. push_str ( query_string_parameters. to_query_string ( ) . as_str ( ) ) ;
457465 }
466+
467+ uri
458468 } )
459469 // multi-valued query string parameters are always a super
460470 // set of singly valued query string parameters,
@@ -507,7 +517,7 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
507517 . method ( http_method)
508518 . uri ( {
509519 let host = headers. get ( http:: header:: HOST ) . and_then ( |val| val. to_str ( ) . ok ( ) ) ;
510- match host {
520+ let mut uri = match host {
511521 Some ( host) => {
512522 format ! (
513523 "{}://{}{}" ,
@@ -520,7 +530,17 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
520530 )
521531 }
522532 None => path. to_string ( ) ,
533+ } ;
534+
535+ if !multi_value_query_string_parameters. is_empty ( ) {
536+ uri. push ( '?' ) ;
537+ uri. push_str ( multi_value_query_string_parameters. to_query_string ( ) . as_str ( ) ) ;
538+ } else if !query_string_parameters. is_empty ( ) {
539+ uri. push ( '?' ) ;
540+ uri. push_str ( query_string_parameters. to_query_string ( ) . as_str ( ) ) ;
523541 }
542+
543+ uri
524544 } )
525545 // multi valued query string parameters are always a super
526546 // set of singly valued query string parameters,
@@ -698,7 +718,7 @@ mod tests {
698718 assert_eq ! ( req. method( ) , "GET" ) ;
699719 assert_eq ! (
700720 req. uri( ) ,
701- "https://wt6mne2s9k.execute-api.us-west-2.amazonaws.com/test/hello"
721+ "https://wt6mne2s9k.execute-api.us-west-2.amazonaws.com/test/hello?name=me "
702722 ) ;
703723
704724 // Ensure this is an APIGW request
@@ -727,7 +747,10 @@ mod tests {
727747 ) ;
728748 let req = result. expect ( "failed to parse request" ) ;
729749 assert_eq ! ( req. method( ) , "GET" ) ;
730- assert_eq ! ( req. uri( ) , "https://lambda-846800462-us-east-2.elb.amazonaws.com/" ) ;
750+ assert_eq ! (
751+ req. uri( ) ,
752+ "https://lambda-846800462-us-east-2.elb.amazonaws.com/?myKey=val2"
753+ ) ;
731754
732755 // Ensure this is an ALB request
733756 let req_context = req. request_context ( ) ;
@@ -822,7 +845,7 @@ mod tests {
822845 ) ;
823846 let req = result. expect ( "failed to parse request" ) ;
824847 assert_eq ! ( req. method( ) , "GET" ) ;
825- assert_eq ! ( req. uri( ) , "/test/hello" ) ;
848+ assert_eq ! ( req. uri( ) , "/test/hello?name=me " ) ;
826849 }
827850
828851 #[ test]
0 commit comments