Skip to content

Enhance Lambda API Gateway Integration to support additional response type, currenty it only support application/json #10

@anejaalekh

Description

@anejaalekh

When integrating API Gateway with Lambda Using https://github.com/owasp-sbot/OSBot-AWS/blob/master/osbot_aws/helpers/Rest_API.py , the integration by default assumes the response type as application/json as per the below code

def add_method_http(self, from_path, from_method, to_method, to_uri):
resource_id = self.resource_id(from_path)
status_code = '200'
response_models = {'application/json': 'Empty'}
response_templates = {'application/json': ''}
method_create = self.api_gateway.method_create (self.id() , resource_id , from_method )
integration_create__http = self.api_gateway.integration_create__http (self.id() , resource_id , to_uri , from_method , to_method )
method_response_create = self.api_gateway.method_response_create (self.id() , resource_id , from_method , status_code ,response_models )
integration_response_create = self.api_gateway.integration_response_create(self.id() , resource_id , from_method , status_code , response_templates)
return { 'method_create' : method_create ,
'integration_create__http' : integration_create__http ,
'method_response_create' : method_response_create ,
'integration_response_create': integration_response_create }

This needs to be refactored so that custom types can be provided. It is useful to have custom type so that we can expose streaming api using lambda + Api Gateway. One usecase for this is to expose streaming API for screenshot lambda where we stream the screenshot png/pdf from S3 bucket

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions