Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServerContext ¶
func NewServerContext(ctx context.Context, tr Transporter) context.Context
NewServerContext returns a new Context that carries value.
Types ¶
type TransportKey ¶
type TransportKey struct{}
type Transporter ¶
type Transporter interface { // Transporter Kind // http: KindHTTP // gRPC: KindGRPC Kind() Kind // RequestHeader returns Transporter request header // http: http.Request.Header // gRPC: metadata.MD RequestHeader() Header // ResponseHeader returns Transporter response header // http: http.ResponseWriter.Header // gRPC: metadata.MD ResponseHeader() Header // SetHeader set response header SetHeader(key, value string) // AddHeader add value to response header AddHeader(key, value string) }
func FromServerContext ¶
func FromServerContext(ctx context.Context) (tr Transporter, ok bool)
FromServerContext returns the Transport value stored in ctx, if any.
Click to show internal directories.
Click to hide internal directories.