我正在尝试使用UriComponentsBuilder构建以下URL:
https://test.com/index.php?/api/v2/get_cases/2&suite_id=19993
我尝试了以下代码:
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString("https://test.com")
.path(Optional.ofNullable("index.php?/api/v2/").orElse(DEFAULT_PATH))
.pathSegment("get_cases", "2");
uriComponentsBuilder.queryParam("suite_id", "19993");
String url uriComponentsBuilder.build().toString;
但是,我得到以下结果,这对我不起作用:
https://test.com/index.php?/api/v2/get_cases/2?suite_id=19993
任何有关如何获得所需结果的帮助吗?