java-sparkpost icon indicating copy to clipboard operation
java-sparkpost copied to clipboard

RestConnection does not honor Client base URL

Open ryantse opened this issue 3 years ago • 0 comments

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());
    }

ryantse avatar Sep 13 '21 20:09 ryantse