Repository: envoyproxy/envoy
File: envoy/router/router.h (C/C++)

Code before:
  ~DirectResponseEntry() override = default;

  /**
   * Returns the HTTP status code to return.
   * @return Http::Code the response Code.
   */
  virtual Http::Code responseCode() const PURE;

  /**
   * Returns the redirect URI based on the request headers.
   * @param headers supplies the request headers.
   * @return std::string the redirect URL if this DirectResponseEntry is a redirect,
   *         or an empty string otherwise.
   */
  virtual std::string newUri(const Http::RequestHeaderMap& headers) const PURE;

  /**
   * Format the response body for direct responses. Users should pass
   * a string reference to populate, `body`, and the return value may
   * or may not be the same reference based on if a formatter is applied.
   * If a formatter is applied, the return value will be the same reference.
   * If no formatter is applied, the return value will be the configured body.
   * @param request_headers supplies the request headers.
   * @param response_headers supplies the response headers.
   * @param stream_info holds additional information about the request.
   * @param body the formatted body to be returned.
   */
  virtual std::string& formatBody(const Http::RequestHeaderMap& request_headers,
                                  const Http::ResponseHeaderMap& response_headers,
                                  const StreamInfo::StreamInfo& stream_info,
                                  std::string& body) const PURE;

  /**
   * Do potentially destructive header transforms on Path header prior to redirection. For
   * example prefix rewriting for redirects etc. This should only be called ONCE
   * immediately prior to redirecting.
   * @param headers supplies the request headers, which may be modified during this call.
   * @param insert_envoy_original_path insert x-envoy-original-path header?
   */
  virtual void rewritePathHeader(Http::RequestHeaderMap& headers,
                                 bool insert_envoy_original_path) const PURE;
};

/**
 * All route specific config returned by the method at
 *   NamedHttpFilterConfigFactory::createRouteSpecificFilterConfig
 * should be derived from this class.
 */
class RouteSpecificFilterConfig {
public:
  virtual ~RouteSpecificFilterConfig() = default;

Review comment (suggestion):
That phrasing sounds like a value is being passed in.
Suggest:
`@param body a string in which a formatted body may be stored.`

Code after:
  ~DirectResponseEntry() override = default;

  /**
   * Returns the HTTP status code to return.
   * @return Http::Code the response Code.
   */
  virtual Http::Code responseCode() const PURE;

  /**
   * Returns the redirect URI based on the request headers.
   * @param headers supplies the request headers.
   * @return std::string the redirect URL if this DirectResponseEntry is a redirect,
   *         or an empty string otherwise.
   */
  virtual std::string newUri(const Http::RequestHeaderMap& headers) const PURE;

  /**
   * Format the response body for direct responses. Users should pass
   * a string reference to populate, `body`, and the return value may
   * or may not be the same reference based on if a formatter is applied.
   * If a formatter is applied, the return value will be the same reference.
   * If no formatter is applied, the return value will be the configured body.
   * @param request_headers supplies the request headers.
   * @param response_headers supplies the response headers.
   * @param stream_info holds additional information about the request.
   * @param body_out a string in which a formatted body may be stored.
   * @return std::string& the response body.
   */
  virtual absl::string_view formatBody(const Http::RequestHeaderMap& request_headers,
                                       const Http::ResponseHeaderMap& response_headers,
                                       const StreamInfo::StreamInfo& stream_info,
                                       std::string& body_out) const PURE;

  /**
   * Do potentially destructive header transforms on Path header prior to redirection. For
   * example prefix rewriting for redirects etc. This should only be called ONCE
   * immediately prior to redirecting.
   * @param headers supplies the request headers, which may be modified during this call.
   * @param insert_envoy_original_path insert x-envoy-original-path header?
   */
  virtual void rewritePathHeader(Http::RequestHeaderMap& headers,
                                 bool insert_envoy_original_path) const PURE;
};

/**
 * All route specific config returned by the method at
 *   NamedHttpFilterConfigFactory::createRouteSpecificFilterConfig
 * should be derived from this class.
 */
class RouteSpecificFilterConfig {
public: