From 9c18870e74236d66eae4f2f36aba8097249285ab Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 29 Nov 2024 20:03:48 +0200 Subject: [PATCH] add resToRawResultFn in API GW --- packages/cubejs-api-gateway/src/gateway.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index f56d804e27001..409e419baca9d 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1983,6 +1983,17 @@ class ApiGateway { return (message, { status }: { status?: number } = {}) => (status ? res.status(status).json(message) : res.json(message)); } + protected resToRawResultFn(res: ExpressResponse) { + return (jsonBuffer: ArrayBuffer, { status }: { status?: number } = {}) => { + if (status) { + res.status(status) + } + + res.set('Content-Type', 'application/json'); + res.send(jsonBuffer); + }; + } + protected parseQueryParam(query): Query | Query[] { if (!query || query === 'undefined') { throw new UserError('Query param is required');