Skip to content

Commit

Permalink
Add PassThroughDecoderFilter
Browse files Browse the repository at this point in the history
Signed-off-by: Auni Ahsan <[email protected]>
  • Loading branch information
auni53 committed Jan 21, 2021
1 parent f2e9074 commit 0fc8ee5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
1 change: 1 addition & 0 deletions test/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ envoy_cc_test(
name = "filter_config_test",
srcs = ["filter_config_test.cc"],
deps = [
"//source/extensions/filters/http/common:pass_through_filter_lib",
"//include/envoy/server:filter_config_interface",
"//test/mocks/server:server_mocks",
],
Expand Down
21 changes: 2 additions & 19 deletions test/server/filter_config_test.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "envoy/server/filter_config.h"

#include "extensions/filters/http/common/pass_through_filter.h"
#include "test/mocks/server/factory_context.h"

#include "gmock/gmock.h"
Expand All @@ -8,24 +9,6 @@
namespace Envoy {
namespace {

class TestHttpFilter : public Http::StreamDecoderFilter {
public:
TestHttpFilter() = default;

Http::FilterHeadersStatus decodeHeaders(Http::RequestHeaderMap&, bool) override {
return Envoy::Http::FilterHeadersStatus::Continue;
}
Http::FilterDataStatus decodeData(Buffer::Instance&, bool) override {
return Envoy::Http::FilterDataStatus::Continue;
}
Http::FilterTrailersStatus decodeTrailers(Http::RequestTrailerMap&) override {
return Envoy::Http::FilterTrailersStatus::Continue;
}

void setDecoderFilterCallbacks(Http::StreamDecoderFilterCallbacks&) override {}
void onDestroy() override{};
};

class TestHttpFilterConfigFactory : public Server::Configuration::NamedHttpFilterConfigFactory {
public:
TestHttpFilterConfigFactory() = default;
Expand All @@ -34,7 +17,7 @@ class TestHttpFilterConfigFactory : public Server::Configuration::NamedHttpFilte
createFilterFactoryFromProto(const Protobuf::Message&, const std::string&,
Server::Configuration::FactoryContext&) override {
return [](Http::FilterChainFactoryCallbacks& callbacks) -> void {
callbacks.addStreamDecoderFilter(std::make_shared<TestHttpFilter>());
callbacks.addStreamDecoderFilter(std::make_shared<Http::PassThroughDecoderFilter>());
};
}

Expand Down

0 comments on commit 0fc8ee5

Please sign in to comment.