mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	if the service name is blank, barf
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user