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
Flowable<HttpResponse<Book>> call = client.exchange(
POST("/amazon/book/{title}", new Book("The Stand"))
.contentType(MediaType.APPLICATION_FORM_URLENCODED),
Book.class
);
Sending a Form Data
Flowable<HttpResponse<Book>> call = client.exchange(
POST("/amazon/book/{title}", new Book("The Stand"))
.contentType(MediaType.APPLICATION_FORM_URLENCODED),
Book.class
)
Sending a Form Data
val call = client.exchange(
POST("/amazon/book/{title}", Book("The Stand"))
.contentType(MediaType.APPLICATION_FORM_URLENCODED),
Book::class.java
)
Note that Jackson is used to bind form data too, so to customize the binding process you can use Jackson annotations.