I am trying to add a default value to an optional header parameter for when it is not present. However, when the parameter is not included, I noticed that it is not being populated with the default value:
public Mono<User> getUser(
@RequestHeader(value = "accept", defaultValue = "abc") String acceptHeader,
...
)
When I am debugging the code, acceptHeader
is "/" when no the param is not specified. I looked online and could not find any reason as to why this is happening. Not sure if it makes a difference, but I am making the call with Postman. Does anyone have any idea why this is happening? I could implement code to handle this logic inside getUser
but I would like to ideally use annotations.