mirror of https://github.com/apache/jclouds.git
JCLOUDS-1443: fix(rest/processor): check if `/` is ending a default endpoint
This commit is contained in:
parent
cf67233765
commit
bcc6a26488
|
@ -573,7 +573,9 @@ public class RestAnnotationProcessor implements Function<Invocation, HttpRequest
|
|||
return null;
|
||||
if (original.getHost() != null)
|
||||
return original;
|
||||
return withHost.resolve(original);
|
||||
String host = withHost.toString();
|
||||
URI baseURI = host.endsWith("/") ? withHost : URI.create(host + "/");
|
||||
return baseURI.resolve(original);
|
||||
}
|
||||
|
||||
private org.jclouds.rest.MapBinder getMapPayloadBinderOrNull(Invocation invocation) {
|
||||
|
|
|
@ -2679,6 +2679,13 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
|
|||
assertEquals(new URI("http://foo/bar"), result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComplexHost() throws Exception {
|
||||
URI result = RestAnnotationProcessor.addHostIfMissing(new URI("bar"), new URI("http://foo/foobar"));
|
||||
assertEquals(new URI("http://foo/foobar/bar"), result);
|
||||
}
|
||||
|
||||
|
||||
DateService dateService = new SimpleDateFormatDateService();
|
||||
RestAnnotationProcessor processor;
|
||||
TransformerForRequest transformer;
|
||||
|
|
Loading…
Reference in New Issue