Commit 3c9cee2a authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Invoke mapStatus() only when necessary

Closes gh-12419
parent 3642636b
......@@ -65,13 +65,13 @@ public class HealthWebEndpointResponseMapper {
*/
public WebEndpointResponse<Health> map(Health health, SecurityContext securityContext,
ShowDetails showDetails) {
Integer status = this.statusHttpMapper.mapStatus(health.getStatus());
if (showDetails == ShowDetails.NEVER
|| (showDetails == ShowDetails.WHEN_AUTHORIZED
&& (securityContext.getPrincipal() == null
|| !isUserInRole(securityContext)))) {
health = Health.status(health.getStatus()).build();
}
Integer status = this.statusHttpMapper.mapStatus(health.getStatus());
return new WebEndpointResponse<>(health, status);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment