@@ -92,6 +92,7 @@ func (s *serviceImpl) DixInject(
92
92
log log.Logger ,
93
93
conf * Config ,
94
94
gw []* gateway.Mux ,
95
+ metadataHandlers []lava.GrpcGatewayMetadata ,
95
96
) {
96
97
s .conf = conf
97
98
if conf .HttpPort == nil {
@@ -239,11 +240,17 @@ func (s *serviceImpl) DixInject(
239
240
return strings .ToUpper (s ), true
240
241
}),
241
242
runtime .WithMetadata (func (ctx context.Context , request * http.Request ) metadata.MD {
242
- path , ok := runtime .HTTPPathPattern (ctx )
243
- if ! ok {
244
- return nil
243
+ rpcPath , _ := runtime .RPCMethod (ctx )
244
+ path , _ := runtime .HTTPPathPattern (ctx )
245
+
246
+ md := metadata .Pairs ("http_path" , path , "http_method" , request .Method , "http_url" , request .URL .Path )
247
+ for _ , h := range metadataHandlers {
248
+ for k , v := range h (ctx , request , rpcPath , path ) {
249
+ md .Append (k , v ... )
250
+ }
245
251
}
246
- return metadata .Pairs ("http_path" , path , "http_method" , request .Method , "http_url" , request .URL .Path )
252
+
253
+ return md
247
254
}),
248
255
runtime .WithErrorHandler (func (ctx context.Context , mux * runtime.ServeMux , marshal runtime.Marshaler , w http.ResponseWriter , request * http.Request , err error ) {
249
256
md , ok := runtime .ServerMetadataFromContext (ctx )
0 commit comments