Hello,
The the method OctoprintApi::sendRequestToOctoprint() seems, with some occasion, loop for ever or almost.
One of the occasion is with this answer (octoprint is down and Nginx is responding) :
HTTP/1.0 502 Bad Gateway
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>502 Bad Gateway</h1>
The server returned an invalid or incomplete response.
</body></html>
The code is waiting for a "Content-Length" that never happen.
What do you think about using ArduinoHttpClient instead of a custom code ?
https://github.com/arduino-libraries/ArduinoHttpClient