Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pods()->logs() will error if the pod's log output is in JSON format #125

Open
i-edwards opened this issue Nov 14, 2023 · 0 comments
Open

Comments

@i-edwards
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant