mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-17 21:07:54 +02:00
expose request from transport (#2427)
This commit is contained in:
parent
9301bfa407
commit
468630cc4b
@ -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
|
||||
|
||||
// Get returns the value associated with the passed key.
|
||||
|
Loading…
x
Reference in New Issue
Block a user