@@ -63,7 +63,7 @@ class TransformationFilterTest : public testing::Test {
63
63
initFilter (); // Re-load config.
64
64
}
65
65
66
- Http::TestHeaderMapImpl headers_{
66
+ Http::TestHeaderMapImpl headers_{{ " content-type " , " test " },
67
67
{" :method" , " GET" }, {" :authority" , " www.solo.io" }, {" :path" , " /path" }};
68
68
69
69
NiceMock<Http::MockStreamDecoderFilterCallbacks> filter_callbacks_;
@@ -162,6 +162,24 @@ TEST_F(TransformationFilterTest, HappyPathWithBodyPassthrough) {
162
162
EXPECT_EQ (Http::FilterDataStatus::Continue, res);
163
163
}
164
164
165
+
166
+ TEST_F (TransformationFilterTest, BodyPassthroughDoesntRemoveContentType) {
167
+ auto &transformation = (*route_config_.mutable_request_transformation ());
168
+ transformation.mutable_transformation_template ()->mutable_passthrough ();
169
+ envoy::api::v2::filter::http::InjaTemplate header_value;
170
+ header_value.set_text (" added-value" );
171
+ (*transformation.mutable_transformation_template ()->mutable_headers ())[" added-header" ] = header_value;
172
+ initFilter (); // Re-load config.
173
+
174
+ auto resheaders = filter_->decodeHeaders (headers_, false );
175
+ EXPECT_EQ (Http::FilterHeadersStatus::Continue, resheaders);
176
+
177
+ // as this is a passthrough body, transformation should have been triggered
178
+ // make sure that transformation did not remove content type.
179
+ EXPECT_EQ (" test" , headers_.get_ (" content-type" ));
180
+ EXPECT_EQ (" added-value" , headers_.get_ (" added-header" ));
181
+ }
182
+
165
183
TEST_F (TransformationFilterTest, HappyPathWithHeadersBodyTemplate) {
166
184
initFilterWithHeadersBody ();
167
185
0 commit comments