def add_file_reference(file_ref, file_refs_url, auth_headers, http_requests):
    """Add a file reference to the analysis metadata in a submission envelope.

    Args:
        file_ref (dict): HCA metadata stub about the file.
        file_refs_url (str): The url for adding file references.
        auth_headers (dict): Dict representing headers to use for auth.
        http_requests (http_requests.HttpRequests): The HttpRequests object to use for talking to Ingest.

    Returns:
        dict: Dict representing the JSON response to the request that adding the file reference.

    Raises:
        requests.HTTPError: For 4xx errors or 5xx errors beyond timeout.
    """
    # Format payload for ingest file reference API endpoint
    file_payload = {'fileName': file_ref['file_core']['file_name'], 'content': file_ref}
    print('Adding file reference: {}'.format(file_payload))
    response = http_requests.put(file_refs_url, headers=auth_headers, json=file_payload)
    return response.json()