diff --git a/build.savant b/build.savant index 95b91df6..51c50aeb 100644 --- a/build.savant +++ b/build.savant @@ -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: diff --git a/src/test/java/org/primeframework/mvc/test/RequestBuilder.java b/src/test/java/org/primeframework/mvc/test/RequestBuilder.java index 60895c19..f6f54e7e 100644 --- a/src/test/java/org/primeframework/mvc/test/RequestBuilder.java +++ b/src/test/java/org/primeframework/mvc/test/RequestBuilder.java @@ -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. * @@ -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. * @@ -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 : ""));