本文整理了Java中io.vertx.reactivex.ext.web.client.HttpResponse.cookies()
方法的一些代码示例,展示了HttpResponse.cookies()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.cookies()
方法的具体详情如下:
包路径:io.vertx.reactivex.ext.web.client.HttpResponse
类名称:HttpResponse
方法名:cookies
暂无
代码示例来源:origin: com.cv4j.netdiscovery/netdiscovery-core
if (Preconditions.isNotBlank(stringHttpResponse.cookies())) {
for (String cookieStr:stringHttpResponse.cookies()) {
} else {
for (String cookieStr:stringHttpResponse.cookies()) {
代码示例来源: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-csrf.json")
public void whenDoPostSecureWithCSRF_expectOK(
VertxTestContext context, Vertx vertx) {
createPassThroughKnot(vertx, "test-splitter");
createPassThroughKnot(vertx, "test-assembler");
createSimpleKnot(vertx, "some-knot", "test", null);
MultiMap body = MultiMap.caseInsensitiveMultiMap().add("field", "value");
WebClient client = WebClient.create(vertx);
client.get(KNOTX_SERVER_PORT, KNOTX_SERVER_ADDRESS, "/content/local/simple.html").send(
ar -> {
if (ar.succeeded()) {
String token = getToken(ar.result().cookies());
client.post(KNOTX_SERVER_PORT, KNOTX_SERVER_ADDRESS, "/content/local/simple.html")
.putHeader(CSRFHandler.DEFAULT_HEADER_NAME, token)
.putHeader(HttpHeaderNames.COOKIE.toString(),
CSRFHandler.DEFAULT_COOKIE_NAME + "=" + token)
.sendForm(body, res -> {
if (res.succeeded()) {
assertEquals(HttpResponseStatus.OK.code(), res.result().statusCode());
context.completeNow();
} else {
context.failNow(ar.cause());
}
});
} else {
context.failNow(ar.cause());
}
});
}
内容来源于网络,如有侵权,请联系作者删除!