Skip to content
Merged
3 changes: 2 additions & 1 deletion samcli/local/apigw/local_apigw_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ def _request_handler(self, **kwargs):
# or none, as the default value to be used is 2.0
# https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid-integrations.html#apis-apiid-integrations-prop-createintegrationinput-payloadformatversion
if route.event_type == Route.HTTP and route.payload_format_version in [None, "2.0"]:
route_key = self._v2_route_key(method, endpoint, route.is_default_route)
apigw_endpoint = PathConverter.convert_path_to_api_gateway(endpoint)
route_key = self._v2_route_key(method, apigw_endpoint, route.is_default_route)
event = self._construct_v_2_0_event_http(
request,
self.port,
Expand Down
4 changes: 3 additions & 1 deletion samcli/local/events/api_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,14 @@ def to_dict(self):
"rawQueryString": self.raw_query_string,
"cookies": self.cookies,
"headers": self.headers,
"queryStringParameters": self.query_string_params,
"requestContext": request_context_dict,
"body": self.body,
"pathParameters": self.path_parameters,
"stageVariables": self.stage_variables,
"isBase64Encoded": self.is_base_64_encoded,
}

if self.query_string_params:
json_dict["queryStringParameters"] = self.query_string_params

return json_dict
1 change: 0 additions & 1 deletion tests/unit/local/events/test_api_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ def test_to_dict_with_defaults(self):
"rawQueryString": None,
"cookies": None,
"headers": None,
"queryStringParameters": None,
"requestContext": {},
"body": None,
"pathParameters": None,
Expand Down