From 7f6fbc76ab6eb46e5484e96ad37ed44098f9f60a Mon Sep 17 00:00:00 2001 From: Santiago Pericas-Geertsen Date: Wed, 19 Feb 2025 14:06:45 -0500 Subject: [PATCH] Updates microprofile test and adds config annotation. Signed-off-by: Santiago Pericas-Geertsen --- .../microprofile/tests/server/BadHostHeaderTest.java | 10 +++++++++- .../io/helidon/webserver/ListenerConfigBlueprint.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/microprofile/tests/server/src/test/java/io/helidon/microprofile/tests/server/BadHostHeaderTest.java b/microprofile/tests/server/src/test/java/io/helidon/microprofile/tests/server/BadHostHeaderTest.java index 1efb71706b2..70932bcdc28 100644 --- a/microprofile/tests/server/src/test/java/io/helidon/microprofile/tests/server/BadHostHeaderTest.java +++ b/microprofile/tests/server/src/test/java/io/helidon/microprofile/tests/server/BadHostHeaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024 Oracle and/or its affiliates. + * Copyright (c) 2021, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,20 @@ import io.helidon.http.Header; import io.helidon.http.HeaderValues; import io.helidon.http.Status; +import io.helidon.microprofile.testing.AddConfig; import io.helidon.microprofile.testing.junit5.AddBean; import io.helidon.microprofile.testing.junit5.HelidonTest; import io.helidon.webclient.api.WebClient; import io.helidon.webserver.http.ServerRequest; +import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.client.WebTarget; import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; +import org.eclipse.microprofile.config.Config; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; @@ -37,9 +40,14 @@ @HelidonTest @AddBean(BadHostHeaderTest.TestResource.class) +@AddConfig(key = "server.error-handling.include-entity", value = "true") public class BadHostHeaderTest { private static final Header BAD_HOST_HEADER = HeaderValues.create("Host", "localhost:808a"); + @Inject + BadHostHeaderTest(Config config) { + } + @Test void testGetGoodHeader(WebTarget target) { String getResponse = target.path("/get").request().get(String.class); diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java b/webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java index e2424dfa56a..653ce6fcf89 100644 --- a/webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java @@ -405,5 +405,6 @@ default void configureSocket(ServerSocket socket) { * * @return optional error handling */ + @Option.Configured Optional errorHandling(); }