本文整理了Java中io.vertx.reactivex.ext.web.client.HttpResponse.getHeader()
方法的一些代码示例,展示了HttpResponse.getHeader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.getHeader()
方法的具体详情如下:
包路径:io.vertx.reactivex.ext.web.client.HttpResponse
类名称:HttpResponse
方法名:getHeader
暂无
代码示例来源:origin: com.cv4j.netdiscovery/netdiscovery-core
response.setContent(html.getBytes());
response.setStatusCode(stringHttpResponse.statusCode());
response.setContentType(stringHttpResponse.getHeader("Content-Type"));
代码示例来源:origin: Cognifide/knotx
@Test
@KnotxApplyConfiguration("io/knotx/server/test-server.json")
public void whenRequestingPostGlobalPathAndActionDoRedirect_expectRedirectResponse(
VertxTestContext context, Vertx vertx) {
createPassThroughKnot(vertx, "test-splitter");
createPassThroughKnot(vertx, "test-assembler");
createSimpleFailingKnot(vertx, "A-post-engine", HttpResponseStatus.MOVED_PERMANENTLY.code(),
MultiMap.caseInsensitiveMultiMap().add("location", "/content/failed.html"));
testPostRequest(context, vertx, "/content/local/simple.html", resp -> {
assertEquals(HttpResponseStatus.MOVED_PERMANENTLY.code(), resp.statusCode());
assertEquals("/content/failed.html", resp.getHeader("location"));
assertNotNull(resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals(EXPECTED_XSERVER_HEADER_VALUE,
resp.getHeader(EXPECTED_RESPONSE_HEADER));
});
}
代码示例来源:origin: Cognifide/knotx
private void testGetRequest(VertxTestContext context, Vertx vertx, String url,
String expectedResult) {
WebClient client = WebClient.create(vertx);
Single<HttpResponse<Buffer>> httpResponseSingle = client
.get(KNOTX_SERVER_PORT, KNOTX_SERVER_ADDRESS, url).rxSend();
subscribeToResult_shouldSucceed(context, httpResponseSingle,
resp -> {
assertEquals(expectedResult, resp.body().toString(),
"Wrong engines processed request, expected " + expectedResult);
assertEquals(HttpResponseStatus.OK.code(), resp.statusCode());
assertNotNull(resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals(EXPECTED_XSERVER_HEADER_VALUE,
resp.getHeader(EXPECTED_RESPONSE_HEADER));
});
}
代码示例来源:origin: Cognifide/knotx
@Test
@KnotxApplyConfiguration("io/knotx/server/test-server-csrf.json")
public void whenRequestingGetLocalPath_expectLocalAC(
VertxTestContext context, Vertx vertx) {
createPassThroughKnot(vertx, "test-splitter");
createPassThroughKnot(vertx, "test-assembler");
createSimpleKnot(vertx, "some-knot", "test", null);
WebClient client = WebClient.create(vertx);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> httpResponseSingle = client
.get(KNOTX_SERVER_PORT, KNOTX_SERVER_ADDRESS, "/content/local/simple.html")
.rxSend();
subscribeToResult_shouldSucceed(context, httpResponseSingle, response -> {
assertEquals(HttpResponseStatus.OK.code(), response.statusCode());
assertTrue(response.getHeader(EXPECTED_RESPONSE_HEADER) != null);
assertEquals(EXPECTED_XSERVER_HEADER_VALUE,
response.getHeader(EXPECTED_RESPONSE_HEADER));
assertTrue(response.cookies().stream()
.anyMatch(cookie -> cookie.contains(CSRFHandler.DEFAULT_COOKIE_NAME)));
});
}
代码示例来源:origin: Cognifide/knotx
@Test
@KnotxApplyConfiguration("io/knotx/server/test-server.json")
public void whenRequestingPostGlobalPath_expectGlobalBC(
VertxTestContext context, Vertx vertx) {
createPassThroughKnot(vertx, "test-splitter");
createPassThroughKnot(vertx, "test-assembler");
createSimpleKnot(vertx, "B-engine", "+B", "go-c");
createSimpleKnot(vertx, "C-engine", "+C", null);
testPostRequest(context, vertx, "/content/simple.html", resp -> {
assertEquals(HttpResponseStatus.OK.code(), resp.statusCode());
assertNotNull(resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals(EXPECTED_XSERVER_HEADER_VALUE,
resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals("global+B+C", resp.bodyAsString(),
"Wrong engines processed request, expected 'global+B+C'");
});
}
代码示例来源:origin: Cognifide/knotx
@Test
@KnotxApplyConfiguration("io/knotx/server/test-server.json")
public void whenRequestingPostLocalPathWithAlternateTransition_expectLocalApostC(
VertxTestContext context, Vertx vertx) {
createPassThroughKnot(vertx, "test-splitter");
createPassThroughKnot(vertx, "test-assembler");
createSimpleKnot(vertx, "A-post-engine", "+Apost", "go-c");
createSimpleKnot(vertx, "C-engine", "+C", null);
testPostRequest(context, vertx, "/content/local/simple.html",
resp -> {
assertEquals(HttpResponseStatus.OK.code(), resp.statusCode());
assertNotNull(resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals(EXPECTED_XSERVER_HEADER_VALUE,
resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals("local+Apost+C", resp.bodyAsString(),
"Wrong engines processed request, expected " + "local+Apost+C");
});
}
代码示例来源:origin: Cognifide/knotx
@Test
@KnotxApplyConfiguration("io/knotx/server/test-server.json")
public void whenRequestingPostLocalPathWithFirstTransition_expectLocalApostBC(
VertxTestContext context, Vertx vertx) {
createPassThroughKnot(vertx, "test-splitter");
createPassThroughKnot(vertx, "test-assembler");
createSimpleKnot(vertx, "A-post-engine", "+Apost", "go-b");
createSimpleKnot(vertx, "B-engine", "+B", "go-c");
createSimpleKnot(vertx, "C-engine", "+C", null);
testPostRequest(context, vertx, "/content/local/simple.html",
resp -> {
assertEquals(HttpResponseStatus.OK.code(), resp.statusCode());
assertNotNull(resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals(EXPECTED_XSERVER_HEADER_VALUE,
resp.getHeader(EXPECTED_RESPONSE_HEADER));
assertEquals("local+Apost+B+C", resp.bodyAsString(),
"Wrong engines processed request, expected " + "local+Apost+B+C");
});
}
内容来源于网络,如有侵权,请联系作者删除!