Repository: envoyproxy/envoy
File: source/common/http/codec_client.h (C/C++)

Code before:
  using Type = Envoy::Http::CodecType;

  /**
   * Add a connection callback to the underlying network connection.
   */
  void addConnectionCallbacks(Network::ConnectionCallbacks& cb) {
    connection_->addConnectionCallbacks(cb);
  }

  /**
   * Return if half-close semantics are enabled on the underlying connection.
   */
  bool isHalfCloseEnabled() { return connection_->isHalfCloseEnabled(); }

  /**
   * Initialize all of the installed read filters on the underlying connection.
   * This effectively calls onNewConnection() on each of them.
   */
  void initializeReadFilters() { connection_->initializeReadFilters(); }

  /**
   * Close the underlying network connection. This is immediate and will not attempt to flush any
   * pending write data.
   */
  void close(Network::ConnectionCloseType type = Network::ConnectionCloseType::NoFlush,
             absl::string_view local_close_reason = absl::string_view());

  /**
   * Send a codec level go away indication to the peer.
   */
  void goAway() { codec_->goAway(); }

  /**
   * @return the underlying connection ID.
   */
  uint64_t id() const { return connection_->id(); }

  /**
   * @return the underlying codec protocol.
   */
  Protocol protocol() { return codec_->protocol(); }

  /**
   * @return the underlying connection error.
   */
  absl::string_view connectionFailureReason() { return connection_->transportFailureReason(); }

  /**
   * @return size_t the number of outstanding requests that have not completed or been reset.
   */
  size_t numActiveRequests() { return active_requests_.size(); }

Review comment (suggestion):
please unify the `local_close_reason` `close_details`, `details`, and unify the usage of `absl::string_view()` and `""`.

Code after:
  using Type = Envoy::Http::CodecType;

  /**
   * Add a connection callback to the underlying network connection.
   */
  void addConnectionCallbacks(Network::ConnectionCallbacks& cb) {
    connection_->addConnectionCallbacks(cb);
  }

  /**
   * Return if half-close semantics are enabled on the underlying connection.
   */
  bool isHalfCloseEnabled() { return connection_->isHalfCloseEnabled(); }

  /**
   * Initialize all of the installed read filters on the underlying connection.
   * This effectively calls onNewConnection() on each of them.
   */
  void initializeReadFilters() { connection_->initializeReadFilters(); }

  /**
   * Close the underlying network connection. This is immediate and will not attempt to flush any
   * pending write data.
   */
  void close(Network::ConnectionCloseType type = Network::ConnectionCloseType::NoFlush,
             absl::string_view details = "");

  /**
   * Send a codec level go away indication to the peer.
   */
  void goAway() { codec_->goAway(); }

  /**
   * @return the underlying connection ID.
   */
  uint64_t id() const { return connection_->id(); }

  /**
   * @return the underlying codec protocol.
   */
  Protocol protocol() { return codec_->protocol(); }

  /**
   * @return the underlying connection error.
   */
  absl::string_view connectionFailureReason() { return connection_->transportFailureReason(); }

  /**
   * @return size_t the number of outstanding requests that have not completed or been reset.
   */
  size_t numActiveRequests() { return active_requests_.size(); }