public static GetOption getGetOption(RestRequest restRequest, GetOption defaultGetOption)
      throws RestServiceException {
    GetOption option = defaultGetOption == null ? GetOption.None : defaultGetOption;
    Object value = restRequest.getArgs().get(RestUtils.Headers.GET_OPTION);
    if (value != null) {
      String str = (String) value;
      boolean foundMatch = false;
      for (GetOption getOption : GetOption.values()) {
        if (str.equalsIgnoreCase(getOption.name())) {
          option = getOption;
          foundMatch = true;
          break;
        }
      }
      if (!foundMatch) {
        throw new RestServiceException("Unrecognized value for [" + RestUtils.Headers.GET_OPTION + "]: " + str,
            RestServiceErrorCode.InvalidArgs);
      }
    }
    return option;
  }
Gets the {@link GetOption} required by the request.
@param restRequest the representation of the request.
@param defaultGetOption the {@link GetOption} to use if the {@code restRequest} doesn't have one. Can be
{@code null}.
@return the required {@link GetOption}. Defaults to {@link GetOption#None}.
@throws RestServiceException if the {@link RestUtils.Headers#GET_OPTION} is present but not recognized.
ambry-api/src/main/java/com/github/ambry/rest/RestUtils.java