From 067f52cf43a1c74d3a475fef3e1e0f7985daa5b5 Mon Sep 17 00:00:00 2001 From: nurdotnet <278048682+nurdotnet@users.noreply.github.com> Date: Tue, 21 Apr 2026 23:32:30 +0500 Subject: [PATCH] fix(moysklad): exact Accept header value per MoySklad requirement (code 1062) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MoySklad rejects application/json without charset=utf-8 with error 1062 "Неверное значение заголовка 'Accept'". They require the exact value "application/json;charset=utf-8". Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Integrations/MoySklad/MoySkladClient.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs index 6d2cbd2..63cc056 100644 --- a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs +++ b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladClient.cs @@ -33,7 +33,10 @@ private HttpRequestMessage Build(HttpMethod method, string pathAndQuery, string { var req = new HttpRequestMessage(method, pathAndQuery); req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); - req.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + // MoySklad requires this exact Accept value (error code 1062 otherwise). + var accept = new MediaTypeWithQualityHeaderValue("application/json"); + accept.Parameters.Add(new System.Net.Http.Headers.NameValueHeaderValue("charset", "utf-8")); + req.Headers.Accept.Add(accept); req.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip")); return req; }