本文整理了Java中io.vertx.ext.web.client.HttpRequest.followRedirects()
方法的一些代码示例,展示了HttpRequest.followRedirects()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.followRedirects()
方法的具体详情如下:
包路径:io.vertx.ext.web.client.HttpRequest
类名称:HttpRequest
方法名:followRedirects
暂无
代码示例来源:origin: vert-x3/vertx-rx
/**
* Set wether or not to follow the directs for the request.
* @param value true if redirections should be followed
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.ext.web.client.HttpRequest<T> followRedirects(boolean value) {
delegate.followRedirects(value);
return this;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Set wether or not to follow the directs for the request.
* @param value true if redirections should be followed
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.ext.web.client.HttpRequest<T> followRedirects(boolean value) {
delegate.followRedirects(value);
return this;
}
代码示例来源:origin: io.vertx/vertx-web-client
@Test
public void testInvalidRedirection() throws Exception {
server.requestHandler(req -> {
assertEquals(HttpMethod.POST, req.method());
assertEquals("/redirect", req.path());
req.response().setStatusCode(302).putHeader("Location", "http://www.google.com").end();
});
startServer();
HttpRequest<Buffer> builder = client
.post("/redirect")
.followRedirects(true);
builder.send(onSuccess(resp -> {
assertEquals(302, resp.statusCode());
assertEquals("http://www.google.com", resp.getHeader("Location"));
assertNull(resp.body());
complete();
}));
await();
}
代码示例来源:origin: io.vertx/vertx-web-client
@Test
public void testRedirectLimit() throws Exception {
String location = "http://" + DEFAULT_HTTP_HOST + ":" + DEFAULT_HTTP_PORT + "/redirect";
server.requestHandler(req -> {
assertEquals(HttpMethod.GET, req.method());
assertEquals("/redirect", req.path());
req.response().setStatusCode(302).putHeader("Location", location).end();
});
startServer();
HttpRequest<Buffer> builder = client
.get("/redirect")
.followRedirects(true);
builder.send(onSuccess(resp -> {
assertEquals(302, resp.statusCode());
assertEquals(location, resp.getHeader("Location"));
assertNull(resp.body());
complete();
}));
await();
}
代码示例来源:origin: io.vertx/vertx-web-client
.putHeader("foo", "bar");
if (set != null) {
builder = builder.followRedirects(set);
内容来源于网络,如有侵权,请联系作者删除!