@@ -441,7 +441,7 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
441
441
. method ( http_method)
442
442
. uri ( {
443
443
let host = headers. get ( http:: header:: HOST ) . and_then ( |val| val. to_str ( ) . ok ( ) ) ;
444
- match host {
444
+ let mut uri = match host {
445
445
Some ( host) => {
446
446
format ! (
447
447
"{}://{}{}" ,
@@ -454,7 +454,17 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
454
454
)
455
455
}
456
456
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 ( ) ) ;
457
465
}
466
+
467
+ uri
458
468
} )
459
469
// multi-valued query string parameters are always a super
460
470
// set of singly valued query string parameters,
@@ -507,7 +517,7 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
507
517
. method ( http_method)
508
518
. uri ( {
509
519
let host = headers. get ( http:: header:: HOST ) . and_then ( |val| val. to_str ( ) . ok ( ) ) ;
510
- match host {
520
+ let mut uri = match host {
511
521
Some ( host) => {
512
522
format ! (
513
523
"{}://{}{}" ,
@@ -520,7 +530,17 @@ impl<'a> From<LambdaRequest<'a>> for http::Request<Body> {
520
530
)
521
531
}
522
532
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 ( ) ) ;
523
541
}
542
+
543
+ uri
524
544
} )
525
545
// multi valued query string parameters are always a super
526
546
// set of singly valued query string parameters,
@@ -698,7 +718,7 @@ mod tests {
698
718
assert_eq ! ( req. method( ) , "GET" ) ;
699
719
assert_eq ! (
700
720
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 "
702
722
) ;
703
723
704
724
// Ensure this is an APIGW request
@@ -727,7 +747,10 @@ mod tests {
727
747
) ;
728
748
let req = result. expect ( "failed to parse request" ) ;
729
749
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
+ ) ;
731
754
732
755
// Ensure this is an ALB request
733
756
let req_context = req. request_context ( ) ;
@@ -822,7 +845,7 @@ mod tests {
822
845
) ;
823
846
let req = result. expect ( "failed to parse request" ) ;
824
847
assert_eq ! ( req. method( ) , "GET" ) ;
825
- assert_eq ! ( req. uri( ) , "/test/hello" ) ;
848
+ assert_eq ! ( req. uri( ) , "/test/hello?name=me " ) ;
826
849
}
827
850
828
851
#[ test]
0 commit comments