private void ensureAccountNameMatch(Account account, RestRequest restRequest) throws RestServiceException {
    String accountNameFromHeader = getHeader(restRequest.getArgs(), Headers.TARGET_ACCOUNT_NAME, false);
    if (accountNameFromHeader != null && !accountNameFromHeader.equals(account.getName())) {
      throw new RestServiceException(
          "Account name in request did not match account name returned by backend. " + "Account in header: '"
              + accountNameFromHeader + "'. Account returned by backend: '" + account.getName() + "'.",
          RestServiceErrorCode.InternalServerError);
    }
  }
Ensures the {@link Account} matches the account name specified in the {@link RestRequest}, if it is specified.
@param account The {@link Account} to ensure.
@param restRequest The {@link RestRequest} to ensure.
@throws RestServiceException if the {@link Account}'s name does not match the name specified in the {@link RestRequest}.
ambry-frontend/src/main/java/com/github/ambry/frontend/AccountAndContainerInjector.java