def add_cors_headers(response, request):
    """Add Cross-Origin Resource Sharing (CORS) headers to response.

    - ``method_list`` is a list of HTTP methods that are allowed for the endpoint that
      was called. It should not include "OPTIONS", which is included automatically
      since it's allowed for all endpoints.

    """
    opt_method_list = ",".join(request.allowed_method_list + ["OPTIONS"])
    response["Allow"] = opt_method_list
    response["Access-Control-Allow-Methods"] = opt_method_list
    response["Access-Control-Allow-Origin"] = request.META.get("Origin", "*")
    response["Access-Control-Allow-Headers"] = "Authorization"
    response["Access-Control-Allow-Credentials"] = "true"
Add Cross-Origin Resource Sharing (CORS) headers to response.

    - ``method_list`` is a list of HTTP methods that are allowed for the endpoint that
      was called. It should not include "OPTIONS", which is included automatically
      since it's allowed for all endpoints.