Skip to content

Commit

Permalink
Updates microprofile test and adds config annotation.
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago Pericas-Geertsen <[email protected]>
  • Loading branch information
spericas committed Feb 19, 2025
1 parent 4669144 commit 7f6fbc7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -19,27 +19,35 @@
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;
import static org.hamcrest.MatcherAssert.assertThat;

@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,5 +405,6 @@ default void configureSocket(ServerSocket socket) {
*
* @return optional error handling
*/
@Option.Configured
Optional<ErrorHandling> errorHandling();
}

0 comments on commit 7f6fbc7

Please sign in to comment.