Added a test for redirection limit in WebClient
@@ -1062,6 +1062,27 @@ public class WebClientTest extends HttpTestBase {
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();
+ }
+
@Test
public void testVirtualHost() throws Exception {
server.requestHandler(req -> {
