Open ghost opened 5 years ago
Looks like the fix for #117 more or less disabled url encoding of the constructed endpoint URLs (unless the URL happen to contain a space). As the problem is with the ConsulRawClient
it affects many methods at the library api level.
A simple workaround is to url encode the serviceName, configKey, etc that eventually get appended into a URL, but I do think it is "leaky" - the user of the library should not need to deal with url encoding.
If a Consul server contains a service with a special character in the name, consul client will throw "Illegal character in path" error. The problem is in the CatalogConsulClient.getCatalogService where a call is made to rawClient by concatenating "/v1/catalog/service" with serviceName without escaping contents of serviceName. The easiest way to reproduce this issue is to register a service with $ in its name, create a basic spring-boot project with /actuator/consul endpoint exposed and then try navigating to that point. Here's a call stack of such application:
create:852, URI (java.net)