C
C
click_f2016-09-09 14:53:34
Java
click_f, 2016-09-09 14:53:34

How to know that RestTemplate#delete(...) worked correctly?

This method returns void. How can I find out the status of the request ok/error?
With other methods like getForObject(), postForObject() everything is clear:
response = restTemplate.getForObject(<...>);
or
response = restTemplate.postForObject(<...>);
and then we extract the necessary fields from the response, for example:
response.getStatus();
Question: how to do the same for the delete() method?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kosarev, 2016-09-11
@jaxtr

As Ivan Sokolov said , if no errors were thrown, then everything is ok. If you are a developer of a rest service that you are pulling, then correct unit and integration tests can add confidence.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question