I am trying to write a client in which I will do the POST method without body. Is the only solution to insert null? example:
client.exchange("/" + userId + "/logout", HttpMethod.POST, null, String.class);
You can also pass HttpEntity.EMPTY (or new HttpEntity<>(null)) there - the result should be the same.
If you have HttpHeaders object - you can also pass it into the corresponding constructor: new HttpEntity<>(httpHeaders)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With