Skip to content

Commit 3dfa2cd

Browse files
awalterschulzefacebook-github-bot
authored andcommitted
replace use cases of thrift.WithProtocol with thrift.WithHeaders
Summary: replace use cases of thrift.WithProtocol with thrift.WithHeaders Reviewed By: codyohl Differential Revision: D59577467 fbshipit-source-id: 08b25a874d669ab260c60d188d00e8e9dd7ede38
1 parent 82d3d16 commit 3dfa2cd

File tree

3 files changed

+1
-9
lines changed

3 files changed

+1
-9
lines changed

thrift/lib/go/thrift/context.go

-5
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ func ConnInfoFromContext(ctx context.Context) (ConnInfo, bool) {
7878
return v, ok
7979
}
8080

81-
// Deprecated: use thrift.WithHeaders(ctx, proto.GetResponseHeaders())
82-
func WithProtocol(ctx context.Context, proto Protocol) context.Context {
83-
return context.WithValue(ctx, protocolKey, proto)
84-
}
85-
8681
// Deprecated: Use thrift.GetHeaders
8782
func HeadersFromContext(ctx context.Context) map[string]string {
8883
t, ok := ctx.Value(protocolKey).(Protocol)

thrift/lib/go/thrift/processor.go

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func processContext(ctx context.Context, processor ProcessorContext, prot Protoc
7171
}
7272
return false, rerr
7373
}
74+
ctx = WithHeaders(ctx, prot.GetResponseHeaders())
7475
var err ApplicationException
7576
var pfunc ProcessorFunctionContext
7677
if messageType != CALL && messageType != ONEWAY {

thrift/lib/go/thrift/simple_server.go

-4
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ func (p *SimpleServer) processRequests(ctx context.Context, client net.Conn) err
124124
return err
125125
}
126126

127-
// Store the protocol on the context so handlers can query headers.
128-
// See HeadersFromContext.
129-
ctx = WithProtocol(ctx, protocol)
130-
131127
defer func() {
132128
if err := recover(); err != nil {
133129
p.log.Printf("panic in processor: %v: %s", err, debug.Stack())

0 commit comments

Comments
 (0)