Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Allow changing the default client used by the static methods #87

Open
emmericp opened this issue May 10, 2018 · 3 comments

Comments

@emmericp
Copy link

It would be nice to be able to change the client used by the default static methods.

The following would be sufficient:

    public synchronized static void setClient(RestClient client) {
        close();
        this.client = client;
    }
emmericp pushed a commit to emmericp/rest-client that referenced this issue May 10, 2018
@joshgontijo
Copy link
Owner

Hi, thanks for the suggestion.
Is there any reason why you can't use the RestClient class ? like
RestClient client = RestClient.builder().build()

Assigning it to a static variable should give you the same behaviour.

@emmericp
Copy link
Author

Yeah, that's actually what I'm doing at the moment. I've just noticed this while porting my code from Unirest; I had expected RestClient do be a drop-in replacement but I couldn't do the proxy config.

@joshgontijo
Copy link
Owner

Yeah, make sense to add it back. I've Added a comment to your PR, happy to merge an release it on 1.6.1 alongside few other changes.

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

Successfully merging a pull request may close this issue.

2 participants