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);
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)