在直到2.7.5的柑橘框架中,可以在HttpClientRequestActionBuilder中发送多个queryparam,而在2.7.6中可能不是因为它正在使用Set。
查看源代码后,发现它在2.7.6中
public HttpMessage queryParam(String name, String value) {
if (!StringUtils.hasText(name)) {
throw new CitrusRuntimeException("Invalid query param name - must not be empty!");
}
this.queryParams.put(name, value);
String queryParamString = queryParams.entrySet()
.stream()
.map(entry -> entry.getKey() + (entry.getValue() != null ? "=" + entry.getValue() : ""))
.collect(Collectors.joining(","));
header(HttpMessageHeaders.HTTP_QUERY_PARAMS, queryParamString);
header(DynamicEndpointUriResolver.QUERY_PARAM_HEADER_NAME, queryParamString);
return this;
}
与2.7.6之前的版本一样
public HttpMessage queryParam(String name, String value) {
if (!StringUtils.hasText(name)) {
throw new CitrusRuntimeException("Invalid query param name - must not be empty!");
}
String queryParams;
if (getHeader(HttpMessageHeaders.HTTP_QUERY_PARAMS) != null) {
queryParams = getHeader(HttpMessageHeaders.HTTP_QUERY_PARAMS).toString();
queryParams += "," + name + (StringUtils.hasText(value) ? "=" + value : "");
} else {
queryParams = name + (StringUtils.hasText(value) ? "=" + value : "");
}
header(HttpMessageHeaders.HTTP_QUERY_PARAMS, queryParams);
header(DynamicEndpointUriResolver.QUERY_PARAM_HEADER_NAME, queryParams);
return this;
}
因此,如果我使用queryParam(“ paramName”,“ value1”)。queryParam(“ paramName”,“ value2”),则仅发送具有“ Value1”的paramName,而不发送“ value2”。
请问为什么要删除此功能或有任何解决方法?