Merge branch '2.0.x'
This commit is contained in:
@@ -99,7 +99,12 @@ public class LoadBalancerFeignClient implements Client {
|
||||
}
|
||||
|
||||
static URI cleanUrl(String originalUrl, String host) {
|
||||
String newUrl = originalUrl.replaceFirst(host, "");
|
||||
String newUrl = originalUrl;
|
||||
if(originalUrl.startsWith("https://")) {
|
||||
newUrl = originalUrl.substring(0, 8) + originalUrl.substring(8 + host.length());
|
||||
} else if(originalUrl.startsWith("http")) {
|
||||
newUrl = originalUrl.substring(0, 7) + originalUrl.substring(7 + host.length());
|
||||
}
|
||||
StringBuffer buffer = new StringBuffer(newUrl);
|
||||
if((newUrl.startsWith("https://") && newUrl.length() == 8) ||
|
||||
(newUrl.startsWith("http://") && newUrl.length() == 7)) {
|
||||
|
||||
@@ -119,6 +119,16 @@ public class FeignRibbonClientTests {
|
||||
any(Options.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyCleanUrl() throws Exception {
|
||||
Request request = new RequestTemplate().method("GET").append("http://tp/abc/bcd.json")
|
||||
.request();
|
||||
this.client.execute(request, new Options());
|
||||
RequestMatcher matcher = new RequestMatcher("http://foo.com:8000/abc/bcd.json");
|
||||
verify(this.delegate).execute(argThat(matcher),
|
||||
any(Options.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void remoteRequestIsSecure() throws Exception {
|
||||
Request request = new RequestTemplate()
|
||||
|
||||
Reference in New Issue
Block a user