mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-07 21:06:11 +00:00
[java] Jersey2 and resttemplate do not correctly send defaultCookies (#4821)
* Java/Jersey2 sends defaultCookies * Send cookie value instead of [value] (resttemplate) * Improve the javadoc string
This commit is contained in:
committed by
William Cheng
parent
3eaafce569
commit
5740348902
@@ -647,14 +647,20 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build cookie header. Keeps a single value per cookie (as per <a href="https://tools.ietf.org/html/rfc6265#section-5.3">
|
||||
* RFC6265 section 5.3</a>).
|
||||
*
|
||||
* @param cookies map all cookies
|
||||
* @return header string for cookies.
|
||||
*/
|
||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||
final StringBuilder cookieValue = new StringBuilder();
|
||||
String delimiter = "";
|
||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||
for (String value : entry.getValue()) {
|
||||
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), entry.getValue()));
|
||||
delimiter = "; ";
|
||||
}
|
||||
final String value = entry.getValue().get(entry.getValue().size() - 1);
|
||||
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value));
|
||||
delimiter = "; ";
|
||||
}
|
||||
return cookieValue.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user