"""
Amazon Aurora Labs for MySQL
AWS Lambda function to expand directory requests to an index.html file for CloudFront

NOTICE:
For testing only, the actual code is inline in the CloudFormation template
(see ../../../template/site.yml).

Dependencies:
none

License:
This sample code is made available under the MIT-0 license. See the LICENSE file.
"""

# Lambda function handler
def lambda_handler(event, context):
    # Request is the response, too
    request = event['Records'][0]['cf']['request']

    # Check if the URI ends with '/', then append 'index.html' to it
    if request['uri'].endswith('/'):
        request['uri'] = request['uri'] + 'index.html'

    # Return modified request
    return request

2622b8416ba16f14e1b1c2379a6678c502f18f78
<mask token>

<mask token>


def lambda_handler(event, context):
    request = event['Records'][0]['cf']['request']
    if request['uri'].endswith('/'):
        request['uri'] = request['uri'] + 'index.html'
    return request

"""
Amazon Aurora Labs for MySQL
AWS Lambda function to expand directory requests to an index.html file for CloudFront

NOTICE:
For testing only, the actual code is inline in the CloudFormation template
(see ../../../template/site.yml).

Dependencies:
none

License:
This sample code is made available under the MIT-0 license. See the LICENSE file.
"""

# Lambda function handler
def lambda_handler(event, context):
    # Request is the response, too
    request = event['Records'][0]['cf']['request']

    # Check if the URI ends with '/', then append 'index.html' to it
    if request['uri'].endswith('/'):
        request['uri'] = request['uri'] + 'index.html'

    # Return modified request
    return request
