This is an automated email from the ASF dual-hosted git repository.

dcelasun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 24fa9d0  THRIFT-4914: Add GetResponseHeadersFromClient helper function
24fa9d0 is described below

commit 24fa9d0728c5893b11901f6ffb25a9e74a4647c8
Author: Yuxuan 'fishy' Wang <[email protected]>
AuthorDate: Sat Nov 9 14:21:10 2019 -0800

    THRIFT-4914: Add GetResponseHeadersFromClient helper function
    
    This is the fourth and final part of THRIFT-4914, which handles the
    client reading part in the response (server -> client direction).
    
    Client: go
    
    This closes #1926.
---
 lib/go/thrift/header_protocol.go | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/go/thrift/header_protocol.go b/lib/go/thrift/header_protocol.go
index 46205b2..99deaf7 100644
--- a/lib/go/thrift/header_protocol.go
+++ b/lib/go/thrift/header_protocol.go
@@ -303,3 +303,17 @@ func (p *THeaderProtocol) ReadBinary() (value []byte, err 
error) {
 func (p *THeaderProtocol) Skip(fieldType TType) error {
        return p.protocol.Skip(fieldType)
 }
+
+// GetResponseHeadersFromClient is a helper function to get the read THeaderMap
+// from the last response received from the given client.
+//
+// If the last response was not sent over THeader protocol,
+// a nil map will be returned.
+func GetResponseHeadersFromClient(c TClient) THeaderMap {
+       if sc, ok := c.(*TStandardClient); ok {
+               if hp, ok := sc.iprot.(*THeaderProtocol); ok {
+                       return hp.transport.readHeaders
+               }
+       }
+       return nil
+}

Reply via email to