How do I read response header from RestTemplate when response code is 403

1.6k Views Asked by At

I am using RoboSpiceManger for APIs, I am able to read/get the response headers for status code is 200 for POST requests using RestTemplate like this:

      ResponseEntity<?> responseEntity = (ResponseEntity<?>) obj;
        String token =responseEntity.getHeaders().getFirst("some_token_key");

But I am unable to read/get the header if the status code is 403. It is giving only SpiceException and I am unable to read the response header in this situation.

0

There are 0 best solutions below