java-sparkpost
java-sparkpost copied to clipboard
RestConnection does not honor Client base URL
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());
}