client.postAbs(AUTH_URL) .as(BodyCodec.jsonObject()) .addQueryParam("grant_type", "client_credentials")
/** * Create an HTTP POST request to send to the server using an absolute URI, specifying a response handler to receive * the response * @param absoluteURI the absolute URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> postAbs(String absoluteURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.postAbs(absoluteURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
/** * Create an HTTP POST request to send to the server using an absolute URI, specifying a response handler to receive * the response * @param absoluteURI the absolute URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> postAbs(String absoluteURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.postAbs(absoluteURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
@Test public void testStreamHttpServerRequest() throws Exception { Buffer expected = TestUtils.randomBuffer(10000); HttpServer server2 = vertx.createHttpServer(new HttpServerOptions().setPort(8081)).requestHandler(req -> req.bodyHandler(body -> { assertEquals(body, expected); req.response().end(); })); startServer(server2); WebClient webClient = WebClient.create(vertx); try { server.requestHandler(req -> webClient.postAbs("http://localhost:8081/") .sendStream(req, onSuccess(resp -> req.response().end("ok")))); startServer(); webClient.post(8080, "localhost", "/").sendBuffer(expected, onSuccess(resp -> { assertEquals("ok", resp.bodyAsString()); complete(); })); await(); } finally { server2.close(); } }