private void SetBundleHeaders(BundleResponse bundleResponse, BundleContext context)
{
if (context.HttpContext.Response == null)
{
return;
}
if (bundleResponse.ContentType != null)
{
context.HttpContext.Response.ContentType = bundleResponse.ContentType;
}
if (context.EnableInstrumentation || context.HttpContext.Response.Cache == null)
{
return;
}
HttpCachePolicyBase cache = context.HttpContext.Response.Cache;
cache.SetCacheability(bundleResponse.Cacheability);
cache.SetOmitVaryStar(true);
cache.SetExpires(DateTime.Now.AddYears(1));
cache.SetValidUntilExpires(true);
cache.SetLastModified(DateTime.Now);
cache.VaryByHeaders["User-Agent"] = true;
}
}