/** * 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; }
/** * 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; }
@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(); }
@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(); }
.putHeader("foo", "bar"); if (set != null) { builder = builder.followRedirects(set);