From 7887e66ca22d12253e39b8a0937748e2e45ac5b7 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sat, 6 Apr 2024 22:59:40 +0300 Subject: [PATCH] Added simple gzip support for json --- .../Controllers/CrashUploadController.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs b/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs index af71085..d84f517 100644 --- a/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs +++ b/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs @@ -112,6 +112,9 @@ private async Task UploadHtmlAsync(CancellationToken ct) private async Task UploadJsonAsync(CancellationToken ct) { + if (Request.Headers.ContentEncoding.Any(x => x?.Equals("gzip,deflate", StringComparison.OrdinalIgnoreCase) == true)) + Request.Body = await _gZipCompressor.DecompressAsync(Request.Body, ct); + if (await HttpContext.Request.ReadFromJsonAsync(_jsonSerializerOptions, ct) is not { CrashReport: { } crashReport, LogSources: { } logSources }) return StatusCode(StatusCodes.Status500InternalServerError);