Sending Form Data

You can also encode a POJO or a map as 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. Flux<HttpResponse<Book>> call = Flux.from(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. Flux<HttpResponse<Book>> call = client.exchange(
  2. POST("/amazon/book/{title}", new Book("The Stand"))
  3. .contentType(MediaType.APPLICATION_FORM_URLENCODED),
  4. Book
  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 can bind form data too, so to customize the binding process use Jackson annotations.