api/router/static: allow to specify body dst (#1486)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
b7b731fc79
commit
e32ca852e0
@ -191,6 +191,7 @@ func (r *staticRouter) Endpoint(req *http.Request) (*api.Service, error) {
|
|||||||
Host: ep.apiep.Host,
|
Host: ep.apiep.Host,
|
||||||
Method: ep.apiep.Method,
|
Method: ep.apiep.Method,
|
||||||
Path: ep.apiep.Path,
|
Path: ep.apiep.Path,
|
||||||
|
Body: ep.apiep.Body,
|
||||||
Stream: ep.apiep.Stream,
|
Stream: ep.apiep.Stream,
|
||||||
},
|
},
|
||||||
Services: services,
|
Services: services,
|
||||||
@ -274,6 +275,7 @@ func (r *staticRouter) endpoint(req *http.Request) (*endpoint, error) {
|
|||||||
for k, v := range matches {
|
for k, v := range matches {
|
||||||
md[fmt.Sprintf("x-api-field-%s", k)] = v
|
md[fmt.Sprintf("x-api-field-%s", k)] = v
|
||||||
}
|
}
|
||||||
|
md["x-api-body"] = ep.apiep.Body
|
||||||
*req = *req.Clone(context.WithValue(ctx, metadata.MetadataKey{}, md))
|
*req = *req.Clone(context.WithValue(ctx, metadata.MetadataKey{}, md))
|
||||||
break pathLoop
|
break pathLoop
|
||||||
}
|
}
|
||||||
@ -285,6 +287,7 @@ func (r *staticRouter) endpoint(req *http.Request) (*endpoint, error) {
|
|||||||
// we got here, so its a match
|
// we got here, so its a match
|
||||||
return ep, nil
|
return ep, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// no match
|
// no match
|
||||||
return nil, fmt.Errorf("endpoint not found for %v", req)
|
return nil, fmt.Errorf("endpoint not found for %v", req)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user