0

I have a requirement in which I need to pass entire HTTP header as argument in spring boot controller can this be done via open-api generator My Controller is like

 @PostMapping(value = "/dummyUrl",
      produces = {APPLICATION_JSON_VALUE},
      consumes = {APPLICATION_JSON_VALUE})
  public ResponseEntity<DummyResponse>  processRequest(@RequestHeader HttpHeaders headers,@RequestBody UserDefineObject userDefineObject)

I Know how to process individual parameters in HttpHeaders by using

parameters: -in:header

inside my yaml file but how to obtain entire httpheader

1 Answers1

0

open API wont generate any header in controller but there are ways to get header using 2 methods

1.Using autowired HttpServletRequest variable ,this is managed by spring boot and is threadsafe, so any class which needs header information inject HttpServletRequest httpServletRequest.

2.The other way is How to retrieve unspec'd headers with openapi-generator (spring)

Hope it helps any one who need it