/** * Configure the request to use a new port <code>value</code>. * @param value * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.client.HttpRequest<T> port(int value) { delegate.port(value); return this; }
/** * Configure the request to use a new port <code>value</code>. * @param value * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.client.HttpRequest<T> port(int value) { delegate.port(value); return this; }
private void handleMutateRequest(HttpContext context) { if (context.phase() == ClientPhase.PREPARE_REQUEST) { context.request().host("localhost"); context.request().port(8080); } context.next(); }
@Test public void testMutateRequestInterceptor() throws Exception { server.requestHandler(req -> req.response().end()); startServer(); client.addInterceptor(this::handleMutateRequest); HttpRequest<Buffer> builder = client.get("/somepath").host("another-host").port(8081); builder.send(onSuccess(resp -> complete())); await(); }
@Test public void testCacheInterceptor() throws Exception { server.requestHandler(req -> fail()); startServer(); client.addInterceptor(this::cacheInterceptorHandler); HttpRequest<Buffer> builder = client.get("/somepath").host("localhost").port(8080); builder.send(onSuccess(resp -> { assertEquals(200, resp.statusCode()); complete(); })); await(); }
HttpRequest<Buffer> builder = client.get("/1").host("localhost").port(8080); builder.send(onSuccess(resp -> { assertEquals(200, resp.statusCode());
ctx.next(); }); HttpRequest<Buffer> builder = client.get("/").host("localhost").port(8080); builder.send(onSuccess(resp -> { assertEquals(302, resp.statusCode());