From 5e5a061e9da9ef1277efe73ce781285090e0de5c Mon Sep 17 00:00:00 2001
From: Josh Humphries <2035234+jhump@users.noreply.github.com>
Date: Thu, 7 Dec 2023 11:21:48 -0500
Subject: [PATCH 1/4] add support for accessing headers and trailers using
CompletableDeferred, which completes when the headers or trailers are
received
---
.../BidirectionalStreamInterface.kt | 20 ++++++++++
.../connectrpc/ClientOnlyStreamInterface.kt | 20 ++++++++++
.../connectrpc/ServerOnlyStreamInterface.kt | 20 ++++++++++
.../connectrpc/http/HTTPClientInterface.kt | 7 +++-
.../connectrpc/impl/BidirectionalStream.kt | 16 +++++++-
.../com/connectrpc/impl/ClientOnlyStream.kt | 10 +++++
.../com/connectrpc/impl/ProtocolClient.kt | 37 +++++++++++++++----
.../com/connectrpc/impl/ServerOnlyStream.kt | 10 +++++
.../com/connectrpc/okhttp/OkHttpStream.kt | 2 +
9 files changed, 131 insertions(+), 11 deletions(-)
diff --git a/library/src/main/kotlin/com/connectrpc/BidirectionalStreamInterface.kt b/library/src/main/kotlin/com/connectrpc/BidirectionalStreamInterface.kt
index 803c4ecf..87778622 100644
--- a/library/src/main/kotlin/com/connectrpc/BidirectionalStreamInterface.kt
+++ b/library/src/main/kotlin/com/connectrpc/BidirectionalStreamInterface.kt
@@ -14,6 +14,7 @@
package com.connectrpc
+import kotlinx.coroutines.Deferred
import kotlinx.coroutines.channels.ReceiveChannel
/**
@@ -27,6 +28,25 @@ interface BidirectionalStreamInterface {
*/
fun responseChannel(): ReceiveChannel