def update_http_headers(resource_data, response_headers):
    """
    Updates resource data dict with AWS entities if matching header found.
    :param resource_data: event's resource data dict
    :param response_headers: response headers from HTTP request
    :return: update resource data dict
    """
    for header_key, header_value in response_headers.items():
        if header_key.lower() == 'x-amzn-requestid':
            if '.appsync-api.' not in resource_data['metadata']['url']:
                resource_data['type'] = 'api_gateway'
            resource_data['metadata']['request_trace_id'] = header_value
            break
    return resource_data
