Fix response_parameter being ignored in put_integration_response
This commit is contained in:
parent
067b7f3f5b
commit
b8aa6ddaea
@ -56,8 +56,10 @@ class Deployment(BaseModel, dict):
|
|||||||
|
|
||||||
|
|
||||||
class IntegrationResponse(BaseModel, dict):
|
class IntegrationResponse(BaseModel, dict):
|
||||||
def __init__(self, status_code, selection_pattern=None):
|
def __init__(self, status_code, selection_pattern=None, response_templates=None):
|
||||||
self["responseTemplates"] = {"application/json": None}
|
if response_templates == None:
|
||||||
|
response_templates = {"application/json": None}
|
||||||
|
self["responseTemplates"] = response_templates
|
||||||
self["statusCode"] = status_code
|
self["statusCode"] = status_code
|
||||||
if selection_pattern:
|
if selection_pattern:
|
||||||
self["selectionPattern"] = selection_pattern
|
self["selectionPattern"] = selection_pattern
|
||||||
@ -72,8 +74,10 @@ class Integration(BaseModel, dict):
|
|||||||
self["requestTemplates"] = request_templates
|
self["requestTemplates"] = request_templates
|
||||||
self["integrationResponses"] = {"200": IntegrationResponse(200)}
|
self["integrationResponses"] = {"200": IntegrationResponse(200)}
|
||||||
|
|
||||||
def create_integration_response(self, status_code, selection_pattern):
|
def create_integration_response(self, status_code, selection_pattern, response_templates):
|
||||||
integration_response = IntegrationResponse(status_code, selection_pattern)
|
if response_templates == {}:
|
||||||
|
response_templates = None
|
||||||
|
integration_response = IntegrationResponse(status_code, selection_pattern, response_templates)
|
||||||
self["integrationResponses"][status_code] = integration_response
|
self["integrationResponses"][status_code] = integration_response
|
||||||
return integration_response
|
return integration_response
|
||||||
|
|
||||||
@ -956,7 +960,7 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
raise InvalidRequestInput()
|
raise InvalidRequestInput()
|
||||||
integration = self.get_integration(function_id, resource_id, method_type)
|
integration = self.get_integration(function_id, resource_id, method_type)
|
||||||
integration_response = integration.create_integration_response(
|
integration_response = integration.create_integration_response(
|
||||||
status_code, selection_pattern
|
status_code, selection_pattern, response_templates
|
||||||
)
|
)
|
||||||
return integration_response
|
return integration_response
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user