pods()->logs() will error if the pod's log output is in JSON format
i-edwards opened this issue · 0 comments
i-edwards commented
I have a job that does some processing and sends its results to stdout in JSON format, e.g. {"name":"job","lines":222,"jobDate":"2023-11-14 07:36:29"}
.
I then query Client::pods()->logs($jobPod)
to retrieve the output of the job.
src/Repositories/PodRepository.php::logs()
is typed to return a string (fine), but the issue is that src/Client.php::sendRequest()
will automatically decode JSON into an array, which will trigger a type error when logs()
tries to return it.
I'm not sure what the best way to fix this is. Maybe the easiest is to have the logs()
function check if the response is an array, and re-encode it?