Bug: Url with path prefix throws an regex error
Hi,
the management api is usually available at scheme://host:port/api/... But it is also desirable (and possible) to set a different path (e.g. for reverse proxy scenarios). This is supported by RabbitMQs "path prefix" option.
Unfortunately EasyNetQ does not support it, see ManagementClient:
var uri = new Uri($"{HostUrl}:{PortNumber}/api/{path}{query ?? string.Empty}");
Using this code snippet also throws an ArgumentException of "hostUrl is illegal":
var initial = new ManagementClient("http://localhost/management/", "guest", "guest");
The solution for this may be straight forward: accept a valid url (including scheme, host, port, path and query parameters) in class ManagementClient and inject the REST api + new query parameters required for the rest call.
This way, the api can be fine tuned with all available options and it may also be possible to tweak the api calls in the future to circumvent a breaking api change in rabbitmq.
Best stpag-cv
I think that would be a nice addition if implemented with backwards compatibility, are you willing to create a PR for this?
https://www.nuget.org/packages/EasyNetQ.Management.Client/2.0.0-beta7