How to check for Accept header in Spring Boot?

25 Views Asked by At

I have an API end-point in Spring Boot, let's say /pokemons. For GET /pokemons I want to have two different responses. The first one is JSON, and the second one is Microsoft Excel file. As far as I know this is done the Accept header. But when writing a Spring Boot controller with @GetMapping annotation there is only produces and consumes. Is there any build-in way to work according to the Accept header?

0

There are 0 best solutions below