private boolean shouldKeepAlive(HttpResponseStatus status) {
    boolean shouldKeepAlive = true;
    if (request != null) {
      if (request.getArgs().containsKey(RestUtils.InternalKeys.KEEP_ALIVE_ON_ERROR_HINT)) {
        shouldKeepAlive =
            Boolean.parseBoolean(request.getArgs().get(RestUtils.InternalKeys.KEEP_ALIVE_ON_ERROR_HINT).toString());
      } else if (request.getRestMethod().equals(RestMethod.POST)) {
        shouldKeepAlive = false;
      } else if (request.getRestMethod().equals(RestMethod.PUT) && (HttpUtil.isTransferEncodingChunked(request.request)
          || HttpUtil.getContentLength(request.request, NettyRequest.UNKNOWN_CONTENT_LENGTH) > 0)) {
        shouldKeepAlive = false;
      }
    }
    return shouldKeepAlive && !forceClose && HttpUtil.isKeepAlive(responseMetadata)
        && !CLOSE_CONNECTION_ERROR_STATUSES.contains(status);
  }
@param status the {@link HttpResponseStatus}
@return {@code true} if the channel should be kept alive
ambry-rest/src/main/java/com/github/ambry/rest/NettyResponseChannel.java