async def _parse_headers(request):
    """Parse the stream to add headers of the http request.

    Args:
        request (StreamReader): With arguments, path, method, query

    Returns:
        dict: headers of the request.
    """
    headers = {}
    while True:
        line = await request.readline()
        try:
            key, value = line.decode().split(':', 1)
            headers[key.lower()] = value.strip()
        except Exception:
            break
    return headers