Skip to content

Commit

Permalink
Enables headers test.
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago Pericasgeertsen <[email protected]>
  • Loading branch information
spericas committed Sep 18, 2023
1 parent cc54ec4 commit a83fcdb
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.hamcrest.CoreMatchers.is;
Expand Down Expand Up @@ -90,7 +89,7 @@ static void basicGetQuery(ServerRequest request, ServerResponse response) {
static void basicHeaders(ServerRequest request, ServerResponse response) {
request.headers()
.stream()
.filter(h -> h.name().startsWith("X-TEST"))
.filter(h -> h.name().startsWith("x-test"))
.forEach(response::header);
response.status(Status.OK_200).send("ok");
}
Expand Down Expand Up @@ -123,11 +122,16 @@ public void queryGetTest() {
}
}

@Test @Disabled
@Test
public void testHeaders() {
String[][] headers = new String[][]{{"X-TEST-ONE", "ONE"}, {"X-TEST-TWO", "TWO"}, {"X-TEST-THREE", "THREE"}};
String[][] headers = new String[][]{
{"x-test-one", "one"},
{"x-test-two", "two"},
{"x-test-three", "three"}
};
MultivaluedHashMap<String, Object> map = new MultivaluedHashMap<>();
Arrays.stream(headers).forEach(a -> map.add(a[0], a[1]));

try (Response response = target("basic").path("headers").request().headers(map).get()) {
assertThat(response.getStatus(), is(200));
assertThat(response.readEntity(String.class), is("ok"));
Expand Down

0 comments on commit a83fcdb

Please sign in to comment.