Skip to content

Commit

Permalink
response_map: fix refactoring that occurred between 1.26 - 1.27
Browse files Browse the repository at this point in the history
This covers 3 refactors:

1. BodyFormatter-->format call removed default from last argument. Refactored here:
envoyproxy#27034

2. filter _--> evaluate func removed default form last arg
making it required. Refactored here:
envoyproxy#27063

3. fromProto func removed multiple arguments to support
`cel` in access logs. This refactor occured here:
envoyproxy#27861

Signed-off-by: Lance Austin <[email protected]>
  • Loading branch information
Lance Austin committed Oct 12, 2023
1 parent 802566a commit af46c35
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions source/common/response_map/response_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class BodyFormatter {
const Http::ResponseTrailerMap& response_trailers,
const StreamInfo::StreamInfo& stream_info, std::string& body,
absl::string_view& content_type) const {
body =
formatter_->format(request_headers, response_headers, response_trailers, stream_info, body);
body = formatter_->format(request_headers, response_headers, response_trailers, stream_info,
body, AccessLog::AccessLogType::NotSet);
content_type = content_type_;
}

Expand All @@ -54,10 +54,8 @@ class ResponseMapper {
public:
ResponseMapper(const envoy::extensions::filters::http::response_map::v3::ResponseMapper& config,
Server::Configuration::CommonFactoryContext& context,
ProtobufMessage::ValidationVisitor& validationVisitor)
: filter_(AccessLog::FilterFactory::fromProto(config.filter(), context.runtime(),
context.api().randomGenerator(),
validationVisitor)) {
ProtobufMessage::ValidationVisitor&)
: filter_(AccessLog::FilterFactory::fromProto(config.filter(), context)) {
if (config.has_status_code()) {
status_code_ = static_cast<Http::Code>(config.status_code().value());
}
Expand Down Expand Up @@ -95,7 +93,8 @@ class ResponseMapper {
}

return filter_->evaluate(stream_info, *request_headers, response_headers,
*Http::StaticEmptyHeaders::get().response_trailers);
*Http::StaticEmptyHeaders::get().response_trailers,
AccessLog::AccessLogType::NotSet);
}

bool rewrite(const Http::RequestHeaderMap&, Http::ResponseHeaderMap& response_headers,
Expand Down

0 comments on commit af46c35

Please sign in to comment.