def remove_binary_support(self, api_id, cors=False):
        """
        Remove binary support
        """
        response = self.apigateway_client.get_rest_api(
            restApiId=api_id
        )
        if "binaryMediaTypes" in response and "*/*" in response["binaryMediaTypes"]:
            self.apigateway_client.update_rest_api(
                restApiId=api_id,
                patchOperations=[
                    {
                        'op': 'remove',
                        'path': '/binaryMediaTypes/*~1*'
                    }
                ]
            )
        if cors:
            # go through each resource and change the contentHandling type
            response = self.apigateway_client.get_resources(restApiId=api_id)
            resource_ids = [
                item['id'] for item in response['items']
                if 'OPTIONS' in item.get('resourceMethods', {})
            ]

            for resource_id in resource_ids:
                self.apigateway_client.update_integration(
                    restApiId=api_id,
                    resourceId=resource_id,
                    httpMethod='OPTIONS',
                    patchOperations=[
                        {
                            "op": "replace",
                            "path": "/contentHandling",
                            "value": ""
                        }
                    ]
                )
def remove_binary_support ( self , api_id , cors = False ) : response = self . apigateway_client . get_rest_api ( restApiId = api_id ) if "binaryMediaTypes" in response and "*/*" in response [ "binaryMediaTypes" ] : self . apigateway_client . update_rest_api ( restApiId = api_id , patchOperations = [ { 'op' : 'remove' , 'path' : '/binaryMediaTypes/*~1*' } ] ) if cors : response = self . apigateway_client . get_resources ( restApiId = api_id ) resource_ids = [ item [ 'id' ] for item in response [ 'items' ] if 'OPTIONS' in item . get ( 'resourceMethods' , { } ) ] for resource_id in resource_ids : self . apigateway_client . update_integration ( restApiId = api_id , resourceId = resource_id , httpMethod = 'OPTIONS' , patchOperations = [ { "op" : "replace" , "path" : "/contentHandling" , "value" : "" } ] )
Remove binary support