I'm creating an endpoint where I want to force the user to set the Accept http header:
@GetMapping("/")
public void get(@RequestHeader(HttpHeaders.ACCEPT) MediaType accept) {
//accept == MediaType.ALL
}
Problem:
localhost:8080/ without any Accept header results in Accept=*/* on Spring side.
Question: how can I tell Spring to not use the */* all by default, and reject requests directly without that header?