@Test public void postForm() throws Exception { int code = 200; statusCode.set(code); AtomicIntegerArray expected = copy(statusCounts); expected.addAndGet(code, 1); final StringBuilder builder = new StringBuilder(); rxHttp.postForm(uri("/echo?foo=bar&name=John+Doe&pct=%2042%25")) .flatMap(res -> { Assert.assertEquals(200, res.getStatus().code()); return res.getContent(); }) .toBlocking() .forEach(byteBuf -> builder.append(byteBuf.toString(Charset.defaultCharset()))); assertEquals(expected, statusCounts); Assert.assertEquals("foo=bar&name=John+Doe&pct=%2042%25", builder.toString()); }
public Observable<HttpClientResponse<ByteBuf>> postForm(URI uri) { Preconditions.checkNotNull(uri.getRawQuery(), "uri.query"); byte[] entity = getBytes(uri.getRawQuery()); return post(uri, HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED, entity); }
RxHttp implements AutoCloseable { public Observable<HttpClientResponse<ByteBuf>> postForm(URI uri) { Preconditions.checkNotNull(uri.getRawQuery(), "uri.query"); byte[] entity = getBytes(uri.getRawQuery()); return post(uri, HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED, entity); } }
RxHttp implements AutoCloseable { public Observable<HttpClientResponse<ByteBuf>> postForm(URI uri) { Preconditions.checkNotNull(uri.getRawQuery(), "uri.query"); byte[] entity = getBytes(uri.getRawQuery()); return post(uri, HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED, entity); } @Inject  RxHttp(Config config, ServerRegistry serverRegistry); }
RxHttp implements AutoCloseable { public Observable<HttpClientResponse<ByteBuf>> postForm(URI uri) { Preconditions.checkNotNull(uri.getRawQuery(), "uri.query"); byte[] entity = getBytes(uri.getRawQuery()); return post(uri, HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED, entity); } @Inject  RxHttp(Config config, ServerRegistry serverRegistry); @Deprecated void start(); @Deprecated void stop(); @Override void close(); Observable<HttpClientResponse<ByteBuf>> get(String uri); Observable<HttpClientResponse<ByteBuf>> get(URI uri); Observable<HttpClientResponse<ByteBuf>> getJson(String uri); Observable<HttpClientResponse<ByteBuf>> getJson(URI uri); Observable<HttpClientResponse<ByteBuf>> post(URI uri, String contentType, byte[] entity); Observable<HttpClientResponse<ByteBuf>> postJson(URI uri, byte[] entity); Observable<HttpClientResponse<ByteBuf>> postJson(URI uri, String entity); Observable<HttpClientResponse<ByteBuf>> postForm(URI uri); Observable<HttpClientResponse<ByteBuf>> put(URI uri, String contentType, byte[] entity); Observable<HttpClientResponse<ByteBuf>> putJson(URI uri, byte[] entity); Observable<HttpClientResponse<ByteBuf>> putJson(URI uri, String entity); Observable<HttpClientResponse<ByteBuf>> delete(String uri); Observable<HttpClientResponse<ByteBuf>> delete(URI uri); Observable<HttpClientResponse<ByteBuf>> deleteJson(String uri); Observable<HttpClientResponse<ByteBuf>> deleteJson(URI uri); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req, String entity); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req, byte[] entity); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req, byte[] entity, SSLContext context); }
RxHttp implements AutoCloseable { public Observable<HttpClientResponse<ByteBuf>> postForm(URI uri) { Preconditions.checkNotNull(uri.getRawQuery(), "uri.query"); byte[] entity = getBytes(uri.getRawQuery()); return post(uri, HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED, entity); } @Inject  RxHttp(Config config, ServerRegistry serverRegistry); @Deprecated void start(); @Deprecated void stop(); @Override void close(); Observable<HttpClientResponse<ByteBuf>> get(String uri); Observable<HttpClientResponse<ByteBuf>> get(URI uri); Observable<HttpClientResponse<ByteBuf>> getJson(String uri); Observable<HttpClientResponse<ByteBuf>> getJson(URI uri); Observable<HttpClientResponse<ByteBuf>> post(URI uri, String contentType, byte[] entity); Observable<HttpClientResponse<ByteBuf>> postJson(URI uri, byte[] entity); Observable<HttpClientResponse<ByteBuf>> postJson(URI uri, String entity); Observable<HttpClientResponse<ByteBuf>> postForm(URI uri); Observable<HttpClientResponse<ByteBuf>> put(URI uri, String contentType, byte[] entity); Observable<HttpClientResponse<ByteBuf>> putJson(URI uri, byte[] entity); Observable<HttpClientResponse<ByteBuf>> putJson(URI uri, String entity); Observable<HttpClientResponse<ByteBuf>> delete(String uri); Observable<HttpClientResponse<ByteBuf>> delete(URI uri); Observable<HttpClientResponse<ByteBuf>> deleteJson(String uri); Observable<HttpClientResponse<ByteBuf>> deleteJson(URI uri); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req, String entity); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req, byte[] entity); Observable<HttpClientResponse<ByteBuf>> submit(HttpClientRequest<ByteBuf> req, byte[] entity, SSLContext context);  }