io.vertx.ext.web.client.HttpRequest.followRedirects()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中io.vertx.ext.web.client.HttpRequest.followRedirects()方法的一些代码示例,展示了HttpRequest.followRedirects()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.followRedirects()方法的具体详情如下:
包路径:io.vertx.ext.web.client.HttpRequest
类名称:HttpRequest
方法名:followRedirects

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);

相关文章