@Override public String getRequestURI() { return clientRequest.path(); }
@Test public void testFollowRedirectLimit() throws Exception { AtomicInteger redirects = new AtomicInteger(); server.requestHandler(req -> { int val = redirects.incrementAndGet(); if (val > 16) { fail(); } else { String scheme = createBaseServerOptions().isSsl() ? "https" : "http"; req.response().setStatusCode(301).putHeader(HttpHeaders.LOCATION, scheme + "://localhost:8080/otherpath").end(); } }); startServer(); client.get(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/somepath", onSuccess(resp -> { assertEquals(16, redirects.get()); assertEquals(301, resp.statusCode()); assertEquals("/otherpath", resp.request().path()); testComplete(); })).setFollowRedirects(true).end(); await(); }
assertEquals(HttpMethod.GET, pushedReq.method()); assertEquals("/wibble?a=b", pushedReq.uri()); assertEquals("/wibble", pushedReq.path()); assertEquals("a=b", pushedReq.query()); pushedReq.handler(onSuccess(resp -> {
/** * @return The path part of the uri. For example /somepath/somemorepath/someresource.foo */ public String path() { String ret = delegate.path(); return ret; }
/** * @return The path part of the uri. For example /somepath/somemorepath/someresource.foo */ public String path() { String ret = delegate.path(); return ret; }
@Override public String getRequestURI() { return clientRequest.path(); }
@Override public String getRequestURI() { return clientRequest.path(); }
@Test public void testFollowRedirectLimit() throws Exception { AtomicInteger redirects = new AtomicInteger(); server.requestHandler(req -> { int val = redirects.incrementAndGet(); if (val > 16) { fail(); } else { String scheme = createBaseServerOptions().isSsl() ? "https" : "http"; req.response().setStatusCode(301).putHeader(HttpHeaders.LOCATION, scheme + "://localhost:8080/otherpath").end(); } }); startServer(); client.get(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/somepath", resp -> { assertEquals(16, redirects.get()); assertEquals(301, resp.statusCode()); assertEquals("/otherpath", resp.request().path()); testComplete(); }).setFollowRedirects(true).end(); await(); }
assertEquals(HttpMethod.GET, pushedReq.method()); assertEquals("/wibble?a=b", pushedReq.uri()); assertEquals("/wibble", pushedReq.path()); assertEquals("a=b", pushedReq.query()); pushedReq.handler(resp -> {
@Override public Handler requestBegin(Void endpointMetric, String remote, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { Handler handler = new Handler(remote, request.path(),request.method().name()); requests.get(local, remote, handler.path, handler.method).increment(); requestCount.get(local, remote, handler.path, handler.method).increment(); handler.timer = responseTime.start(local, remote, handler.path, handler.method); return handler; }
case SEND_REQUEST: assertEquals(redirects.getAndIncrement(), ctx.redirects()); requestUris.add(ctx.clientRequest().path()); break;