You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We current put all HTTP/1.1 headers and all gRPC metadata values into the ctx context.Context with context.WithValue(. We just use string keys for the string values.
Putting them into the context as strings is bad form as it could conflict with others just using string values (though no one should be using it)
I propose we add a type to each transport for their respective request values (headers and metadata).
Example HTTP
# svc/transport_http.go
type HTTPHeaders struct{}
func headersToContext(ctx context.Context, r *http.Request) context.Context {
return context.WithValue(ctx, HTTPHeaders, r.Header)
}
We current put all HTTP/1.1 headers and all gRPC metadata values into the
ctx context.Context
withcontext.WithValue(
. We just usestring
keys for thestring
values.Putting them into the context as strings is bad form as it could conflict with others just using string values (though no one should be using it)
I propose we add a type to each transport for their respective request values (headers and metadata).
Example HTTP
Same basic idea with GRPC.
We could also use this to put other values, or the entire original request into the context.
Another value would be the HTTP method that was used, could be useful for knowing if a custom verb was used: #230
The text was updated successfully, but these errors were encountered: