Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/envoy/config/core/v3/base.proto
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ message HeaderValueOption {
HeaderValue header = 1 [(validate.rules).message = {required: true}];

// Should the value be appended? If true (default), the value is appended to
// existing values.
// existing values. Otherwise it replaces any existing values.
google.protobuf.BoolValue append = 2;
}

Expand Down
2 changes: 1 addition & 1 deletion api/envoy/config/core/v4alpha/base.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion generated_api_shadow/envoy/config/core/v3/base.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion generated_api_shadow/envoy/config/core/v4alpha/base.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/common/router/header_formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HeaderFormatter {

/**
* @return bool indicating whether the formatted header should be appended to the existing
* headers
* headers or replace any existing values for the header
*/
virtual bool append() const PURE;
};
Expand Down
16 changes: 8 additions & 8 deletions test/common/router/header_formatter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ TEST(HeaderParserTest, TestParseInternal) {
}

TEST(HeaderParserTest, EvaluateHeaders) {
const std::string ymal = R"EOF(
const std::string yaml = R"EOF(
match: { prefix: "/new_endpoint" }
route:
cluster: "www2"
Expand All @@ -974,7 +974,7 @@ match: { prefix: "/new_endpoint" }
)EOF";

HeaderParserPtr req_header_parser =
HeaderParser::configure(parseRouteFromV3Yaml(ymal).request_headers_to_add());
HeaderParser::configure(parseRouteFromV3Yaml(yaml).request_headers_to_add());
Http::TestRequestHeaderMapImpl header_map{{":method", "POST"}};
NiceMock<Envoy::StreamInfo::MockStreamInfo> stream_info;
req_header_parser->evaluateHeaders(header_map, stream_info);
Expand All @@ -983,7 +983,7 @@ match: { prefix: "/new_endpoint" }
}

TEST(HeaderParserTest, EvaluateEmptyHeaders) {
const std::string ymal = R"EOF(
const std::string yaml = R"EOF(
match: { prefix: "/new_endpoint" }
route:
cluster: "www2"
Expand All @@ -996,7 +996,7 @@ match: { prefix: "/new_endpoint" }
)EOF";

HeaderParserPtr req_header_parser =
HeaderParser::configure(parseRouteFromV3Yaml(ymal).request_headers_to_add());
HeaderParser::configure(parseRouteFromV3Yaml(yaml).request_headers_to_add());
Http::TestRequestHeaderMapImpl header_map{{":method", "POST"}};
std::shared_ptr<NiceMock<Envoy::Upstream::MockHostDescription>> host(
new NiceMock<Envoy::Upstream::MockHostDescription>());
Expand All @@ -1009,7 +1009,7 @@ match: { prefix: "/new_endpoint" }
}

TEST(HeaderParserTest, EvaluateStaticHeaders) {
const std::string ymal = R"EOF(
const std::string yaml = R"EOF(
match: { prefix: "/new_endpoint" }
route:
cluster: "www2"
Expand All @@ -1022,7 +1022,7 @@ match: { prefix: "/new_endpoint" }
)EOF";

HeaderParserPtr req_header_parser =
HeaderParser::configure(parseRouteFromV3Yaml(ymal).request_headers_to_add());
HeaderParser::configure(parseRouteFromV3Yaml(yaml).request_headers_to_add());
Http::TestRequestHeaderMapImpl header_map{{":method", "POST"}};
NiceMock<Envoy::StreamInfo::MockStreamInfo> stream_info;
req_header_parser->evaluateHeaders(header_map, stream_info);
Expand Down Expand Up @@ -1132,7 +1132,7 @@ request_headers_to_remove: ["x-nope"]
}

TEST(HeaderParserTest, EvaluateHeadersWithAppendFalse) {
const std::string ymal = R"EOF(
const std::string yaml = R"EOF(
match: { prefix: "/new_endpoint" }
route:
cluster: "www2"
Expand Down Expand Up @@ -1161,7 +1161,7 @@ match: { prefix: "/new_endpoint" }
)EOF";

// Disable append mode.
envoy::config::route::v3::Route route = parseRouteFromV3Yaml(ymal);
envoy::config::route::v3::Route route = parseRouteFromV3Yaml(yaml);
route.mutable_request_headers_to_add(0)->mutable_append()->set_value(false);
route.mutable_request_headers_to_add(1)->mutable_append()->set_value(false);
route.mutable_request_headers_to_add(2)->mutable_append()->set_value(false);
Expand Down