SparkPost / java-sparkpost

SparkPost client library for Java
https://www.sparkpost.com/
Other
39 stars 35 forks source link

RestConnection does not honor Client base URL #106

Open ryantse opened 3 years ago

ryantse commented 3 years ago

When creating a RestConnection by passing a Client object, the endpoint URL set in the client is ignored.

Specifically, this call:

    public RestConnection(Client client) throws SparkPostException {
        this(client, "" /* means:set to default endpoint */);
    }

in https://github.com/SparkPost/java-sparkpost/blob/master/libs/sparkpost-lib/src/main/java/com/sparkpost/transport/RestConnection.java#L78

If the Client has a set endpoint already, that should be honored the passing it to the RestClient instead of targeting the default region. i.e.

    public RestConnection(Client client) throws SparkPostException {
        this(client, client.getBaseUrl());
    }