0

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);
sicio
  • 117
  • 1
  • 6

1 Answers1

3

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)

amseager
  • 5,795
  • 4
  • 24
  • 47