LCOV - code coverage report
Current view: top level - source/extensions/http/header_formatters/preserve_case - config.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 7 12 58.3 %
Date: 2024-01-05 06:35:25 Functions: 2 4 50.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "envoy/extensions/http/header_formatters/preserve_case/v3/preserve_case.pb.h"
       4             : #include "envoy/http/header_formatter.h"
       5             : #include "envoy/registry/registry.h"
       6             : 
       7             : #include "source/common/protobuf/utility.h"
       8             : #include "source/extensions/http/header_formatters/preserve_case/preserve_case_formatter.h"
       9             : 
      10             : namespace Envoy {
      11             : namespace Extensions {
      12             : namespace Http {
      13             : namespace HeaderFormatters {
      14             : namespace PreserveCase {
      15             : 
      16             : class PreserveCaseFormatterFactory : public Envoy::Http::StatefulHeaderKeyFormatterFactory {
      17             : public:
      18             :   PreserveCaseFormatterFactory(
      19             :       const bool forward_reason_phrase,
      20             :       const envoy::extensions::http::header_formatters::preserve_case::v3::
      21             :           PreserveCaseFormatterConfig::FormatterTypeOnEnvoyHeaders formatter_type_on_envoy_headers)
      22             :       : forward_reason_phrase_(forward_reason_phrase),
      23           0 :         formatter_type_on_envoy_headers_(formatter_type_on_envoy_headers) {}
      24             : 
      25             :   // Envoy::Http::StatefulHeaderKeyFormatterFactory
      26           0 :   Envoy::Http::StatefulHeaderKeyFormatterPtr create() override {
      27           0 :     return std::make_unique<PreserveCaseHeaderFormatter>(forward_reason_phrase_,
      28           0 :                                                          formatter_type_on_envoy_headers_);
      29           0 :   }
      30             : 
      31             : private:
      32             :   const bool forward_reason_phrase_;
      33             :   const envoy::extensions::http::header_formatters::preserve_case::v3::PreserveCaseFormatterConfig::
      34             :       FormatterTypeOnEnvoyHeaders formatter_type_on_envoy_headers_;
      35             : };
      36             : 
      37             : class PreserveCaseFormatterFactoryConfig
      38             :     : public Envoy::Http::StatefulHeaderKeyFormatterFactoryConfig {
      39             : public:
      40             :   // Envoy::Http::StatefulHeaderKeyFormatterFactoryConfig
      41          42 :   std::string name() const override {
      42          42 :     return "envoy.http.stateful_header_formatters.preserve_case";
      43          42 :   }
      44             : 
      45             :   Envoy::Http::StatefulHeaderKeyFormatterFactorySharedPtr
      46             :   createFromProto(const Protobuf::Message& message) override;
      47             : 
      48           2 :   ProtobufTypes::MessagePtr createEmptyConfigProto() override {
      49           2 :     return std::make_unique<envoy::extensions::http::header_formatters::preserve_case::v3::
      50           2 :                                 PreserveCaseFormatterConfig>();
      51           2 :   }
      52             : };
      53             : 
      54             : DECLARE_FACTORY(PreserveCaseFormatterFactoryConfig);
      55             : 
      56             : } // namespace PreserveCase
      57             : } // namespace HeaderFormatters
      58             : } // namespace Http
      59             : } // namespace Extensions
      60             : } // namespace Envoy

Generated by: LCOV version 1.15