mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
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.
This commit is contained in:
parent
59694a796f
commit
24fa9d0728
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user