<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...

[ ] bug report
[x] feature request

# Detailed description

The API Gateway response body only accepts strings. To transfer binary data, it needs to be base64 encoded, inserted as a string in the response body and the flag ´isBase64Encoded´ must be set. Once this is done API Gateway will base64 decode the response and return the binary content to the requester.

## Expected behavior

When setting the isBase64Encoded flag, the response is base64 decoded before being returned from API Gateway.

## Actual behavior

Setting the isBase64Encoded flag has no effect, the response body will contain the base64 encoded string instead of binary data.

# Steps to reproduce

## Command used to start LocalStack

Docker compose config:
```
version: '2.1'

services:
  docker-host:
    image: qoomon/docker-host:2.5.0
    cap_add: [ 'NET_ADMIN', 'NET_RAW' ]
    mem_limit: 20M
    restart: on-failure
  localstack:
    image: localstack/localstack:0.12.10
    depends_on: [ docker-host ]
    ports:
      - "4566:4566"
      - "4571:4571"
    environment:
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR}
      - DATA_DIR=${TMPDIR}/data
      - DEFAULT_REGION=eu-west-1
      - LAMBDA_REMOTE_DOCKER=0
      - LAMBDA_EXECUTOR=docker-reuse
      - LAMBDA_DOCKER_NETWORK=scripts_default
      - AWS_CBOR_DISABLE=true
    volumes:
      - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

```

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)

Need to set up a Lambda Rest API that returns a base64 encoded string, where the flag `isBase64Encoded` is set. The returned response should reflect the base64 decoded version of the string.

def start_http_backend(test_port):
        # test 
        class TestListener(ProxyListener):
            def forward_request(self, **kwargs):
                response = Response()
                response.status_code = 200
                result = {
                    'data': kwargs.get('data') or '{}',
                    'headers': dict(kwargs.get('headers'))
                }
                response._content = json.dumps(json_safe(result))
                return response
        proxy = start_proxy(test_port, update_listener=TestListener())
        return proxy
    @staticmethod
    def create_api_gateway_and_deploy(response_templates=None, is_api_key_required=False,
            integration_type=None, integration_responses=None):
        response_templates = response_templates or {}
        integration_type = integration_type or 'AWS_PROXY'
        apigw
        response = apigw_client.create_rest_api(name='my_api', description='this is my api')
        api_id = response['id']
        resources = apigw_client.get_resources(restApiId=api_id)
        root_resources = [resource for resource in resources['items'] if resource['path'] == '/']
        root_id = root_resources[0]['id']
        kwargs = {}
        if integration_type == 'AWS_PROXY':
            aws_stack.create_dynamodb_table('MusicCollection', partition_key='id')
            kwargs['uri'] = 'arn:aws:apigateway:us-east-1:dynamodb:action/PutItem&Table=MusicCollection'
        if not integration_responses: