fix(moysklad): exact Accept header value per MoySklad requirement (code 1062)
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) <noreply@anthropic.com>
This commit is contained in:
parent
05553bdc3d
commit
067f52cf43
|
|
@ -33,7 +33,10 @@ private HttpRequestMessage Build(HttpMethod method, string pathAndQuery, string
|
||||||
{
|
{
|
||||||
var req = new HttpRequestMessage(method, pathAndQuery);
|
var req = new HttpRequestMessage(method, pathAndQuery);
|
||||||
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
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"));
|
req.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue