Sending Form Data

You can also encode a POJO or a map as regular form data instead of JSON. Just set the content type to application/x-www-form-urlencoded on the post request:

Sending a Form Data

  1. Flowable<HttpResponse<Book>> call = client.exchange(
  2. POST("/amazon/book/{title}", new Book("The Stand"))
  3. .contentType(MediaType.APPLICATION_FORM_URLENCODED),
  4. Book.class
  5. );

Sending a Form Data

  1. Flowable<HttpResponse<Book>> call = client.exchange(
  2. POST("/amazon/book/{title}", new Book("The Stand"))
  3. .contentType(MediaType.APPLICATION_FORM_URLENCODED),
  4. Book.class
  5. )

Sending a Form Data

  1. val call = client.exchange(
  2. POST("/amazon/book/{title}", Book("The Stand"))
  3. .contentType(MediaType.APPLICATION_FORM_URLENCODED),
  4. Book::class.java
  5. )

Note that Jackson is used to bind form data too, so to customize the binding process you can use Jackson annotations.