Documentation ¶
Index ¶
- Constants
- func GetBearerTokenFromContext(ctx context.Context) (token string)
- func GetIPAdressFromContext(ctx context.Context) (ip string, err error)
- func GetUUIDFromContext(ctx context.Context) string
- func IsGrpcNativeRequest(req *http.Request) bool
- func IsGrpcRequest(req *http.Request) bool
- func IsGrpcRequestReflection(req *http.Request) bool
- func IsGrpcWebRequest(req *http.Request) bool
- func NewContextFromRequest(r *http.Request) context.Context
- type ErrorObjectMsg
- type NiceMD
- func (m NiceMD) Add(key string, value string) NiceMD
- func (m NiceMD) Clone(copiedKeys ...string) NiceMD
- func (m NiceMD) Del(key string) NiceMD
- func (m NiceMD) Get(key string) string
- func (m NiceMD) GetAll() (res map[string]string)
- func (m NiceMD) Set(key string, value string) NiceMD
- func (m NiceMD) ToHttpHeader() (req http.Header)
- func (m NiceMD) ToIncoming(ctx context.Context) context.Context
- func (m NiceMD) ToJSON() []byte
- func (m NiceMD) ToJSONString() string
- func (m NiceMD) ToOutgoing(ctx context.Context) context.Context
- type Status
Constants ¶
const GrpcContentType = "application/grpc"
const GrpcWebContentType = "application/grpc-web"
const GrpcWebTextContentType = "application/grpc-web-text"
Variables ¶
This section is empty.
Functions ¶
func GetBearerTokenFromContext ¶ added in v0.0.5
func GetIPAdressFromContext ¶
func GetUUIDFromContext ¶ added in v0.0.5
func IsGrpcNativeRequest ¶
func IsGrpcRequest ¶
func IsGrpcRequestReflection ¶
func IsGrpcWebRequest ¶
Types ¶
type ErrorObjectMsg ¶ added in v0.0.3
type NiceMD ¶
NiceMD is a convenience wrapper definiting extra functions on the metadata.
func ExtractIncoming ¶
ExtractIncoming extracts an inbound metadata from the server-side context.
This function always returns a NiceMD wrapper of the metadata.MD, in case the context doesn't have metadata it returns a new empty NiceMD.
func ExtractOutgoing ¶
ExtractOutgoing extracts an outbound metadata from the client-side context.
This function always returns a NiceMD wrapper of the metadata.MD, in case the context doesn't have metadata it returns a new empty NiceMD.
func (NiceMD) Add ¶
Add retrieves a single value from the metadata.
It works analogously to http.Header.Add, as it appends to any existing values associated with key.
The function is binary-key safe.
func (NiceMD) Clone ¶
Clone performs a *deep* copy of the metadata.MD.
You can specify the lower-case copiedKeys to only copy certain whitelisted keys. If no keys are explicitly whitelisted all keys get copied.
func (NiceMD) Del ¶
Del retrieves a single value from the metadata.
It works analogously to http.Header.Del, deleting all values if they exist.
The function is binary-key safe.
func (NiceMD) Get ¶
Get retrieves a single value from the metadata.
It works analogously to http.Header.Get, returning the first value if there are many set. If the value is not set, an empty string is returned.
The function is binary-key safe.
func (NiceMD) Set ¶
Set sets the given value in a metadata.
It works analogously to http.Header.Set, overwriting all previous metadata values.
The function is binary-key safe.
func (NiceMD) ToHttpHeader ¶
func (NiceMD) ToIncoming ¶
ToIncoming sets the given NiceMD as a server-side context for dispatching.
This is mostly useful in ServerInterceptors..