From 326d38275da7a46534ac600bce5b7df6e6be7648 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 20 Aug 2023 20:08:18 -0400 Subject: [PATCH] fix: if we have data, set dummy header response, parse data to a uint8array and process as a chunk --- src/transport.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/transport.ts b/src/transport.ts index 4e21b78..85412b2 100644 --- a/src/transport.ts +++ b/src/transport.ts @@ -32,7 +32,12 @@ class HyperTransport implements grpc.Transport { return; } - this.options.onChunk(ret.data); + if (ret.data) { + this.options.onHeaders(new grpc.Metadata(), 200); + ret.data = new Uint8Array(Object.values(ret.data)); + this.options.onChunk(ret.data); + } + this.options.onEnd(); }