From 7d033818cf9252f6528fb02590dc00decc517fb5 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Thu, 29 Aug 2019 13:10:06 +0100 Subject: [PATCH] if the service name is blank, barf --- proxy/mucp/mucp.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/proxy/mucp/mucp.go b/proxy/mucp/mucp.go index ec95f407..8b25d22d 100644 --- a/proxy/mucp/mucp.go +++ b/proxy/mucp/mucp.go @@ -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