PlayFab / consuldotnet

.NET API for Consul (http://www.consul.io/)
Apache License 2.0
692 stars 193 forks source link

QueryOptions not applied to request #98

Closed Crozin closed 7 years ago

Crozin commented 7 years ago

It seems that library ignores QueryOptions parameter:

        var options = QueryOptions.Default;
        options.Datacenter = "myCustomDc";

        var qr = await cc
            .Health
            .Service("myService", "myTag", true, options);

Results in query for /v1/health/service/myService?tag=myTag&passing=1 instead of /v1/health/service/myService?tag=myTag&passing=1&dc=myCustomDc

highlyunavailable commented 7 years ago

This is incorrect usage. QueryOptions.Default should not be used/modified. Make a new QueryOptions instance then set your custom DC, for example:

        var options = new QueryOptions();
        options.Datacenter = "myCustomDc";

        var qr = await cc
            .Health
            .Service("myService", "myTag", true, options);