3

In spring framework, @GetMapping doesn't have a body. But it has a 'consumes' attribute. So how does it use this attribute without a body?

example:

@GetMapping(value = "/methodA", consumes = "application/json")
nonder
  • 115
  • 7

1 Answers1

1

You can read queryParam/Request HTTP header as below:

@GetMapping(value = "{URL}")
public ResponseEntity getMethod(@RequestParam("consumes") String consumes) {
        return ResponseEntity.ok().build();
}
Dada
  • 6,313
  • 7
  • 24
  • 43
Mohan k
  • 68
  • 4
  • Thanks for the answer. But this was not what I meant. I added an example to the question to be more clear. – nonder Jan 05 '22 at 06:11