提交 f4872e8a 编写于 作者: J Jake Wharton

Remove web URL and ignore SSL boolean from Server.

These do not belong here.
上级 208a0603
......@@ -12,59 +12,27 @@ public class Server {
public static final String DEFAULT_TYPE = "production";
private final String apiUrl;
private final String webUrl;
private final String type;
private final boolean ignoreSslWarnings;
public Server(String apiUrl, String webUrl) {
this(apiUrl, webUrl, false);
public Server(String apiUrl) {
this(apiUrl, DEFAULT_TYPE);
}
public Server(String apiUrl, String webUrl, boolean ignoreSslWarnings) {
this(apiUrl, webUrl, DEFAULT_TYPE, ignoreSslWarnings);
}
public Server(String apiUrl, String webUrl, String type, boolean ignoreSslWarnings) {
public Server(String apiUrl, String type) {
if (!apiUrl.endsWith("/")) {
apiUrl += "/";
}
this.apiUrl = apiUrl;
if (!webUrl.endsWith("/")) {
webUrl += "/";
}
this.webUrl = webUrl;
this.type = type;
this.ignoreSslWarnings = ignoreSslWarnings;
}
/**
* Gets the base API url. Includes a trailing '/'.
*/
/** Gets the base API url. Includes a trailing '/'. */
public String apiUrl() {
return apiUrl;
}
/**
* Gets the base URL for Square's web site. Includes a trailing '/'.
*/
public String webUrl() {
return webUrl;
}
/**
* Gets a human-readable server type for differentiating between multiple instances.
*/
/** Gets a human-readable server type for differentiating between multiple instances. */
public String type() {
return type;
}
/**
* Returns true if we should ignore SSL warnings. Returns false by default.
* Ignored for development servers.
*/
public boolean ignoreSslWarnings() {
return ignoreSslWarnings;
}
}
......@@ -57,7 +57,7 @@ public class RestAdapterTest {
mockCallback = createMock(Callback.class);
mockResponse = createMock(HttpResponse.class);
Server server = new Server("http://host/api/", "http://host/web/", true);
Server server = new Server("http://host/api/");
Provider<HttpClient> httpClientProvider = new Provider<HttpClient>() {
@Override public HttpClient get() {
return mockHttpClient;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册