mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
if the service name is blank, barf
This commit is contained in:
parent
b3aef71fdb
commit
7d033818cf
@ -161,9 +161,6 @@ func (p *Proxy) manageRouteCache(route router.Route, action string) error {
|
||||
}
|
||||
p.Routes[route.Service][route.Hash()] = route
|
||||
case "delete":
|
||||
if _, ok := p.Routes[route.Service]; !ok {
|
||||
return fmt.Errorf("route not found")
|
||||
}
|
||||
delete(p.Routes[route.Service], route.Hash())
|
||||
default:
|
||||
return fmt.Errorf("unknown action: %s", action)
|
||||
@ -219,6 +216,11 @@ func (p *Proxy) ServeRequest(ctx context.Context, req server.Request, rsp server
|
||||
// endpoint to call
|
||||
endpoint := req.Endpoint()
|
||||
|
||||
if len(service) == 0 {
|
||||
b, _ := req.Read()
|
||||
return errors.BadRequest("go.micro.proxy", "service name is blank")
|
||||
}
|
||||
|
||||
// are we network routing or local routing
|
||||
if len(p.Links) == 0 {
|
||||
local = true
|
||||
|
Loading…
Reference in New Issue
Block a user