using System.Net.Http.Headers; namespace Nuuru.Server.Extensions { public static class HttpResponseExtensions { public static void SetFileCacheHeaders(this HttpResponse response, bool isPrivate = false) { var visibility = isPrivate ? "private" : "public"; response.Headers.CacheControl = $"{visibility}, max-age=2592000"; } /// /// Sets headers for serving user-uploaded files inline safely. /// public static void SetInlineFileHeaders(this HttpResponse response, string? fileName = null) { var disposition = new ContentDispositionHeaderValue("inline"); if (!string.IsNullOrEmpty(fileName)) disposition.FileName = fileName; response.Headers["Content-Disposition"] = disposition.ToString(); response.Headers["X-Content-Type-Options"] = "nosniff"; response.Headers["Content-Security-Policy"] = "sandbox"; } } }