mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-22 16:07:49 +08:00
15 lines
363 B
Go
15 lines
363 B
Go
package httpclient
|
|
|
|
import "context"
|
|
|
|
type transportKey struct{}
|
|
|
|
func contextWithTransportTag(ctx context.Context, transportTag string) context.Context {
|
|
return context.WithValue(ctx, transportKey{}, transportTag)
|
|
}
|
|
|
|
func transportTagFromContext(ctx context.Context) (string, bool) {
|
|
value, loaded := ctx.Value(transportKey{}).(string)
|
|
return value, loaded
|
|
}
|