WIP showing that added Content-Lengths get stripped/ignored

This commit is contained in:
sneurlax 2023-09-11 18:41:37 -05:00
parent 20e5f74ab2
commit ba42b76296

View file

@ -39,8 +39,13 @@ class PaynymIsApi {
version + version +
(endpoint.startsWith("/") ? endpoint : "/$endpoint"); (endpoint.startsWith("/") ? endpoint : "/$endpoint");
final uri = Uri.parse(url); final uri = Uri.parse(url);
// Calculate the body length.
int contentLength = utf8.encode(jsonEncode(body)).length;
final headers = { final headers = {
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'Content-Length': contentLength.toString(), // Set the Content-Length header.
}..addAll(additionalHeaders); }..addAll(additionalHeaders);
final response = await client.post( final response = await client.post(
url: uri, url: uri,