1package protocol
2
3import (
4	"context"
5)
6
7type key int
8
9const (
10	requestKey key = iota
11)
12
13func ContextWithRequestHeader(ctx context.Context, request *RequestHeader) context.Context {
14	return context.WithValue(ctx, requestKey, request)
15}
16
17func RequestHeaderFromContext(ctx context.Context) *RequestHeader {
18	request := ctx.Value(requestKey)
19	if request == nil {
20		return nil
21	}
22	return request.(*RequestHeader)
23}
24