How to read header value from feign Response

Viewed 34

i am using spring boot to call a openfeign client and from the Response of that feign i need to extract some header values.how can i do that. can anybody help please. just help me wheather we can do that or not!

1 Answers

You can use import feign.Response as a response like:

@PostMapping("/test")
Response test(@RequestBody TestRequest testRequest);

then you can reach http header

response.headers().get(HEADER_NAME).toString();

if you want get body in this case you have to some json-string manipulation by use response.body() this page may help you for this

Related