Invoke mapStatus() only when necessary

Closes gh-12419
pull/12411/merge
Johnny Lim 7 years ago committed by Stephane Nicoll
parent 3642636b60
commit 3c9cee2a8c

@ -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);
}

Loading…
Cancel
Save