<!-- 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.

content = json.loads(result._content)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(content['headers'].get(HEADER_LOCALSTACK_REQUEST_URL),
            f'http://localhost:{config.EDGE_PORT}/person/123')
        
        client.delete_rest_api(restApiId=api_id)
        proxy.stop()
    def test_api_gateway_s3_get_integration(self):
        apigw
        s3_client = aws_stack.connect_to_service('s3')
        bucket_name = 'test-bucket'
        object_name = 'test.json'
        object_content = '{ "success": "true" }'
        object_content_type = 'application/json'
        api = apigw_client.create_rest_api(name='test')
        api_id = api['id']
        s3_client.create_bucket(Bucket=bucket_name)
        s3_client.put_object(Bucket=bucket_name, Key=object_name, Body=object_content, ContentType=object_content_type)
        self.connect_api_gateway_to_s3(bucket_name, object_name, api_id, 'GET')
        apigw_client.create_deployment(restApiId=api_id, stageName='test')
        url = gateway_request_url(api_id, 'test', '/')
        result = requests.get(url)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.text, object_content)
        self.assertEqual(result.headers['content-type'], object_content_type)
        
        apigw_client.delete_rest_api(restApiId=api_id)
        s3_client.delete_object(Bucket=bucket_name, Key=object_name)
        s3_client.delete_bucket(Bucket=bucket_name)
    def test_api_mock_integration_response_params(self):