Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.savant
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ logbackVersion = "1.5.13"
slf4jVersion = "2.0.13"
testngVersion = "7.8.0"

project(group: "org.primeframework", name: "prime-mvc", version: "5.8.1", licenses: ["ApacheV2_0"]) {
project(group: "org.primeframework", name: "prime-mvc", version: "5.8.2", licenses: ["ApacheV2_0"]) {
workflow {
fetch {
// Dependency resolution order:
Expand Down
29 changes: 16 additions & 13 deletions src/test/java/org/primeframework/mvc/test/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,17 +491,6 @@ public RequestBuilder withCookie(String name, String value) throws Exception {
return withCookie(name, value, false, false);
}

/**
* Encrypt the provided value and add a cookie with the encrypted value to the request
*
* @param name The name of the cookie.
* @param value The unencrypted value of the cookie.
* @return This.
*/
public RequestBuilder withEncryptedCookie(String name, String value) throws Exception {
return withCookie(name, value, false, true);
}

/**
* Add a cookie to the request.
*
Expand All @@ -526,6 +515,17 @@ public RequestBuilder withEncoding(Charset encoding) {
return this;
}

/**
* Encrypt the provided value and add a cookie with the encrypted value to the request
*
* @param name The name of the cookie.
* @param value The unencrypted value of the cookie.
* @return This.
*/
public RequestBuilder withEncryptedCookie(String name, String value) throws Exception {
return withCookie(name, value, false, true);
}

/**
* Adds a file.
*
Expand Down Expand Up @@ -887,9 +887,12 @@ HTTPResponseWrapper run() {
var requestBuilder = HttpRequest.newBuilder()
.method(request.getMethod().name(), bodyPublisher);

if (!locales.isEmpty()) {
requestBuilder.setHeader("Accept-Language", locales.stream().map(Locale::toLanguageTag).collect(Collectors.joining(", ")));
if (locales.isEmpty()) {
// request.getLocale() returns a default locale if none are set by httpRequestConsumer but
// we still want to set to the system's default, if none were explicitly set.
locales = List.of(Locale.getDefault());
}
requestBuilder.setHeader("Accept-Language", locales.stream().map(Locale::toLanguageTag).collect(Collectors.joining(", ")));

if (contentType != null) {
requestBuilder.setHeader(Headers.ContentType, contentType + (characterEncoding != null ? "; charset=" + characterEncoding : ""));
Expand Down