From 1ef337a0f6b5ce68ba8752033e95735e8aa99dbf Mon Sep 17 00:00:00 2001 From: nurdotnet <278048682+nurdotnet@users.noreply.github.com> Date: Tue, 21 Apr 2026 23:46:12 +0500 Subject: [PATCH] fix(moysklad): drop Accept-Encoding: gzip to avoid JSON parse failure HttpClient in DI isn't configured with AutomaticDecompression, so MoySklad returned a gzip-compressed body that ReadFromJsonAsync choked on (0x1F is the gzip magic byte). Cheapest correct fix is to not advertise gzip. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Integrations/MoySklad/MoySkladClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs index a4ece45..3c1c394 100644 --- a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs +++ b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs @@ -37,7 +37,8 @@ private HttpRequestMessage Build(HttpMethod method, string pathAndQuery, string // after ';'). The typed MediaTypeWithQualityHeaderValue API normalizes to // "application/json; charset=utf-8" which MoySklad rejects with code 1062. req.Headers.TryAddWithoutValidation("Accept", "application/json;charset=utf-8"); - req.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip")); + // Don't advertise gzip — HttpClient here isn't configured with AutomaticDecompression, + // and the JSON deserializer would choke on the gzip magic byte (0x1F). return req; }