@@ -44,6 +44,10 @@ def _get_default_headers(context: RestApiInvocationContext) -> dict[str, str]:
44
44
"user-agent" : f"AmazonAPIGateway_{ context .api_id } " ,
45
45
}
46
46
47
+ @staticmethod
48
+ def _get_integration_timeout (integration : Integration ) -> float :
49
+ return int (integration .get ("timeoutInMillis" , 29000 )) / 1000
50
+
47
51
48
52
class RestApiHttpIntegration (BaseRestApiHttpIntegration ):
49
53
"""
@@ -70,8 +74,9 @@ def invoke(self, context: RestApiInvocationContext) -> Response:
70
74
if method not in NO_BODY_METHODS :
71
75
request_parameters ["data" ] = integration_req ["body" ]
72
76
73
- # TODO: configurable timeout (29 by default)
74
- # request_parameters["timeout"] = 29
77
+ # TODO: configurable timeout (29 by default) (check type and default value in provider)
78
+ # integration: Integration = context.resource_method["methodIntegration"]
79
+ # request_parameters["timeout"] = self._get_integration_timeout(integration)
75
80
# TODO: check for redirects
76
81
# request_parameters["allow_redirects"] = False
77
82
@@ -128,6 +133,9 @@ def invoke(self, context: RestApiInvocationContext) -> Response:
128
133
if method not in NO_BODY_METHODS :
129
134
request_parameters ["data" ] = invocation_req ["body" ]
130
135
136
+ # TODO: configurable timeout (29 by default) (check type and default value in provider)
137
+ # request_parameters["timeout"] = self._get_integration_timeout(integration)
138
+
131
139
request_response = requests .request (** request_parameters )
132
140
133
141
response_headers = Headers (dict (request_response .headers ))
0 commit comments