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
2dec150888
commit
591fe84dd9
|
@ -573,7 +573,9 @@ public class RestAnnotationProcessor implements Function<Invocation, HttpRequest
|
||||||
return null;
|
return null;
|
||||||
if (original.getHost() != null)
|
if (original.getHost() != null)
|
||||||
return original;
|
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) {
|
private org.jclouds.rest.MapBinder getMapPayloadBinderOrNull(Invocation invocation) {
|
||||||
|
|
|
@ -2679,6 +2679,13 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
|
||||||
assertEquals(new URI("http://foo/bar"), result);
|
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();
|
DateService dateService = new SimpleDateFormatDateService();
|
||||||
RestAnnotationProcessor processor;
|
RestAnnotationProcessor processor;
|
||||||
TransformerForRequest transformer;
|
TransformerForRequest transformer;
|
||||||
|
|
Loading…
Reference in New Issue