Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/main/java/com/sybit/airtable/Airtable.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,15 @@ public Airtable configure(Configuration config, ObjectMapper objectMapper) throw
* @param proxy
*/
public void setProxy(String proxy) {
if (proxy != null && !proxy.isEmpty() && !proxy.equals(" ")) {

if (proxy == null) {
this.config.setProxy(proxy);
Unirest.setProxy(null);
} else {
this.config.setProxy(proxy);
Unirest.setProxy(HttpHost.create(this.config.getProxy()));
}

}

/**
Expand All @@ -200,18 +206,22 @@ private void configureProxy(String endpointUrl) {
&& (endpointUrl.contains("127.0.0.1")
|| endpointUrl.contains("localhost"))) {
LOG.info("Use Proxy: ignored for 'localhost' ann '127.0.0.1'");
this.config.setProxy(null);
setProxy(null);
} else if (httpsProxy != null
&& (endpointUrl.contains("https"))) {
LOG.info("Use Proxy: Environment variable 'https_proxy' found and used: " + httpsProxy);
this.config.setProxy(httpProxy);
setProxy(httpProxy);
} else if (httpProxy != null
&& (endpointUrl.contains("http"))) {
LOG.info("Use Proxy: Environment variable 'http_proxy' found and used: " + httpProxy);
this.config.setProxy(httpsProxy);
setProxy(httpsProxy);
} else {
this.config.setProxy(null);
setProxy(null);
}
} else if ((endpointUrl.contains("127.0.0.1")
|| endpointUrl.contains("localhost"))) {
LOG.info("Use Proxy: ignored for 'localhost' ann '127.0.0.1'");
setProxy(null);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/sybit/airtable/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class BaseTest {
@Before
public void before() throws AirtableException{

this.airtable = new Airtable().configure(new Configuration("123","url",null));
this.airtable = new Airtable().configure(new Configuration("123","http://localhost",null));


}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/sybit/airtable/TableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TableTest {
@Before
public void before() throws AirtableException{

Airtable airtable = new Airtable().configure(new Configuration("123","url",null));
Airtable airtable = new Airtable().configure(new Configuration("123","https://url",null));
this.base = new Base("base", airtable);

}
Expand Down