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) <noreply@anthropic.com>
This commit is contained in:
parent
5d308a0538
commit
1ef337a0f6
|
|
@ -37,7 +37,8 @@ private HttpRequestMessage Build(HttpMethod method, string pathAndQuery, string
|
||||||
// after ';'). The typed MediaTypeWithQualityHeaderValue API normalizes to
|
// after ';'). The typed MediaTypeWithQualityHeaderValue API normalizes to
|
||||||
// "application/json; charset=utf-8" which MoySklad rejects with code 1062.
|
// "application/json; charset=utf-8" which MoySklad rejects with code 1062.
|
||||||
req.Headers.TryAddWithoutValidation("Accept", "application/json;charset=utf-8");
|
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;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue