public void testResponseTrailersPutIndividually() {
testResponseTrailers(true);
}
private void testResponseTrailers(boolean individually) {
MultiMap trailers = getHeaders(10);
server.requestHandler(req -> {
req.response().setChunked(true);
if (individually) {
for (Map.Entry<String, String> header : trailers) {
req.response().trailers().add(header.getKey(), header.getValue());
}
} else {
req.response().trailers().setAll(trailers);
}
req.response().end();
});
server.listen(onSuccess(s -> {
client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, resp -> {
resp.endHandler(v -> {
assertEquals(trailers.size(), resp.trailers().size());
for (Map.Entry<String, String> entry : trailers) {
assertEquals(entry.getValue(), resp.trailers().get(entry.getKey()));
}
testComplete();
});