expose request from transport (#2427)

pull/2428/head
Tony Chen 2 years ago committed by GitHub
parent 9301bfa407
commit 468630cc4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      transport/http/transport.go

@ -70,6 +70,16 @@ func SetOperation(ctx context.Context, op string) {
} }
} }
// RequestFromServerContext returns request from context.
func RequestFromServerContext(ctx context.Context) (*http.Request, bool) {
if tr, ok := transport.FromServerContext(ctx); ok {
if tr, ok := tr.(*Transport); ok {
return tr.request, true
}
}
return nil, false
}
type headerCarrier http.Header type headerCarrier http.Header
// Get returns the value associated with the passed key. // Get returns the value associated with the passed key.

Loading…
Cancel
Save