Using the rest api (bat_api) the response json is truncated and therefore the json is not valid.
This happens only since Drupal 10.2 I understand because of this change:
https://www.drupal.org/node/3298551
This is truncated because the Content-length header is returned with the length value of the response content.
This is done in the
web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php
on line 48:
$response->headers->set('Content-Length', strlen($content), TRUE);
Actually the content length gets it right, it is correct, but then nginx for some reason cuts it 2 characters before. Maybe it is that the final content is 2 characters bigger, but I have not been able to find out at the moment.
As a temporary solution I have created this MR where I only add 2 more characters:
$response->headers->set('Content-Length', strlen($content)+2, TRUE);
And also to see if more people have the same problem and if so, let's see if we can find a real solution between all of us.
To summarize: Without this MR the json response is cut off and is not valid and with the MR it is correct.