0

I've tried adding in a Filter and the response.getHeaderNames() doesn't have anything.

I've also tried adding in a @ControllerAdvice to a class that implements ResponseBodyAdvice and doing a response.getHeaders() on the ServerHttpResponse object - it says it has no headers. But when I curl an endpoint, I see lots of headers being returned.

How do I get all headers from a response in Spring Boot? Additionally, there doesn't seem to be a way to get the returned HTTP protocol from a response either.

ben l
  • 95
  • 1
  • 8

1 Answers1

0

I was able to figure it out: see https://stackoverflow.com/a/45585071/12075726

The interceptor's aftercomplete method had all the headers that were about to be sent to the client.

ben l
  • 95
  • 1
  • 8