Repository: envoyproxy/envoy
File: api/envoy/config/route/v3/route_components.proto (Protocol Buffers)

Code before:
  RedirectResponseCode response_code = 3 [(validate.rules).enum = {defined_only: true}];

  // Indicates that during redirection, the query portion of the URL will
  // be removed. Default value is false.
  bool strip_query = 6;
}

message DirectResponseAction {
  option (udpa.annotations.versioning).previous_message_type =
      "envoy.api.v2.route.DirectResponseAction";

  // Specifies the HTTP response status to be returned.
  uint32 status = 1 [(validate.rules).uint32 = {lt: 600 gte: 200}];

  // Specifies the content of the response body. If this setting is omitted,
  // no body is included in the generated response.
  //
  // .. note::
  //
  //   Headers can be specified using ``response_headers_to_add`` in the enclosing
  //   :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` or
  //   :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`.
  core.v3.DataSource body = 2;

  // Specifies a format string for the response body. If ``body_format`` is not provided,
  // and ``body`` is, the contents of ``body`` will be used to populate the body of the
  // generated response without formatting.
  core.v3.SubstitutionFormatString body_format = 3;
}

// [#not-implemented-hide:]
message NonForwardingAction {
}

message Decorator {
  option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.Decorator";

  // The operation name associated with the request matched to this route. If tracing is
  // enabled, this information will be used as the span name reported for this request.
  //
  // .. note::
  //
  //   For ingress (inbound) requests, or egress (outbound) responses, this value may be overridden
  //   by the :ref:`x-envoy-decorator-operation
  //   <config_http_filters_router_x-envoy-decorator-operation>` header.
  string operation = 1 [(validate.rules).string = {min_len: 1}];

  // Whether the decorated details should be propagated to the other party. The default is ``true``.
  google.protobuf.BoolValue propagate = 2;
}


Review comment (suggestion):
I think the `!body_format && body` is pretty clear. What should probably be clarified is:
- `body_format && body`, and in this case I assume `body_format` will take precedence (please also update the comment of `body` - see [example](https://github.com/envoyproxy/envoy/blob/8a169711edf696051c2b5079a93aac2e539dbfa3/api/envoy/config/tap/v3/common.proto#L36-L38)). (after briefly looking at the code changes, it is not clear to me if this requires the `body` to be present, and works on top of that or not - this should be clarified).
- `!body_format && !body`, no body will be in the generated response.

Code after:
  RedirectResponseCode response_code = 3 [(validate.rules).enum = {defined_only: true}];

  // Indicates that during redirection, the query portion of the URL will
  // be removed. Default value is false.
  bool strip_query = 6;
}

message DirectResponseAction {
  option (udpa.annotations.versioning).previous_message_type =
      "envoy.api.v2.route.DirectResponseAction";

  // Specifies the HTTP response status to be returned.
  uint32 status = 1 [(validate.rules).uint32 = {lt: 600 gte: 200}];

  // Specifies the content of the response body. If this setting is omitted,
  // no body is included in the generated response.
  //
  // .. note::
  //
  //   Headers can be specified using ``response_headers_to_add`` in the enclosing
  //   :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` or
  //   :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`.
  core.v3.DataSource body = 2;

  // Specifies a format string for the response body. If present, the contents of
  // ``body_format`` will be formatted and used as the response body, where the
  // contents of ``body`` (may be empty) will be passed as the variable ``%LOCAL_REPLY_BODY%``.
  // If neither are provided, no body is included in the generated response.
  core.v3.SubstitutionFormatString body_format = 3;
}

// [#not-implemented-hide:]
message NonForwardingAction {
}

message Decorator {
  option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.Decorator";

  // The operation name associated with the request matched to this route. If tracing is
  // enabled, this information will be used as the span name reported for this request.
  //
  // .. note::
  //
  //   For ingress (inbound) requests, or egress (outbound) responses, this value may be overridden
  //   by the :ref:`x-envoy-decorator-operation
  //   <config_http_filters_router_x-envoy-decorator-operation>` header.
  string operation = 1 [(validate.rules).string = {min_len: 1}];

  // Whether the decorated details should be propagated to the other party. The default is ``true``.
  google.protobuf.BoolValue propagate = 2;
}