From f10533d53068a087d4f0786adc677dab3b84442b Mon Sep 17 00:00:00 2001 From: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com> Date: Thu, 25 May 2023 11:05:11 +0300 Subject: [PATCH] Handle log responses as text Log endpoint always responds as `Content-Type: text/plain` but empty responses are converted to empty objects in JsonApi. In case of resolved non-string log response, consider it empty (string). Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com> --- packages/core/src/common/k8s-api/endpoints/pod.api.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/common/k8s-api/endpoints/pod.api.ts b/packages/core/src/common/k8s-api/endpoints/pod.api.ts index c63f970edf..3b336de577 100644 --- a/packages/core/src/common/k8s-api/endpoints/pod.api.ts +++ b/packages/core/src/common/k8s-api/endpoints/pod.api.ts @@ -57,6 +57,12 @@ export class PodApi extends KubeApi { async getLogs(params: ResourceDescriptor, query?: PodLogsQuery): Promise { const path = `${this.getUrl(params)}/log`; - return this.request.get(path, { query }); + const logs = await this.request.get(path, { query }); + + if (typeof logs !== "string") { + return ""; + } + + return logs; } }