Skip to content

Use raw_query_string to populate QueryStringParameters #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lambda-http/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ fn into_api_gateway_v2_request(ag: ApiGatewayV2httpRequest) -> http::Request<Bod
let http_method = ag.request_context.http.method.clone();
let raw_path = ag.raw_path.unwrap_or_default();

// don't use the query_string_parameters from API GW v2 to
// populate the QueryStringParameters extension because
// the value is not compatible with the whatgw specification.
// See: https://github.com/awslabs/aws-lambda-rust-runtime/issues/470
// See: https://url.spec.whatwg.org/#urlencoded-parsing
let query_string_parameters = if let Some(query) = &ag.raw_query_string {
query.parse().unwrap() // this is Infallible
} else {
ag.query_string_parameters
};

let builder = http::Request::builder()
.uri({
let scheme = ag
Expand All @@ -87,7 +98,7 @@ fn into_api_gateway_v2_request(ag: ApiGatewayV2httpRequest) -> http::Request<Bod
url
})
.extension(RawHttpPath(raw_path))
.extension(QueryStringParameters(ag.query_string_parameters))
.extension(QueryStringParameters(query_string_parameters))
.extension(PathParameters(QueryMap::from(ag.path_parameters)))
.extension(StageVariables(QueryMap::from(ag.stage_variables)))
.extension(RequestContext::ApiGatewayV2(ag.request_context));
Expand Down