namespace RpgRoller.Tests; public sealed class ResponseCompressionApiTests : ApiTestBase { public ResponseCompressionApiTests(WebApplicationFactory factory) : base(factory) { } [Fact] public async Task AuthenticatedJsonResponses_EnableGzipCompression() { using var factory = CreateFactory(); using var client = factory.CreateClient(new() { AllowAutoRedirect = false }); await RegisterAsync(client, "gm-compress", "Password123", "GM"); await LoginAsync(client, "gm-compress", "Password123"); _ = await PostAsync(client, "/api/campaigns", new("Compressed", "d6")); var request = new HttpRequestMessage(HttpMethod.Get, "/api/campaigns"); request.Headers.Add("Accept-Encoding", "gzip"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Assert.Contains("gzip", response.Content.Headers.ContentEncoding); } }