Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Using the Builder to create a Consul Object, URL is cutted #142

Closed
Bryann opened this issue Jul 12, 2016 · 5 comments
Closed

Using the Builder to create a Consul Object, URL is cutted #142

Bryann opened this issue Jul 12, 2016 · 5 comments

Comments

@Bryann
Copy link
Contributor

Bryann commented Jul 12, 2016

Hi,

i'm currently facing the following issue:

I try to create a new Consul object using the Consul.builder().withUrl(urlString);
The urlString has the following pattern:

https://<IP>/path/to/consul

If i build my object using build(), the createRetrofit() Method is executed.
Within this method, my given URL will be cutted/modified to https://<IP>/v1 instead of https://<IP>/path/to/consul/v1
This leads to a 404 and the Consul API is not reachable.

Is there a reason for this? I tried to change the Code in Consul.java to the following:

            return new Retrofit.Builder()
// new way
                    .baseUrl(consulUrl.toExternalForm() + "/v1/")
// old way
//                    .baseUrl(new URL(consulUrl.getProtocol(), consulUrl.getHost(),
//                            consulUrl.getPort(), "/v1/").toExternalForm())
                    .addConverterFactory(JacksonConverterFactory.create(mapper))
                    .client(builder.build())
                    .build();

This works fine for me. But i don't think its a solution for all possible use cases.

@rickfast
Copy link
Owner

I'll take a look at this soon

@Bryann
Copy link
Contributor Author

Bryann commented Sep 15, 2016

Any update here? :)

@rickfast
Copy link
Owner

fixed by a4cfd6a

@Bryann
Copy link
Contributor Author

Bryann commented Sep 20, 2016

Thanks for the fix,

can you create a new release for the it?

@rickfast
Copy link
Owner

this fix is in 0.12.8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants