Coverage Report

Created: 2023-11-12 09:30

/proc/self/cwd/source/common/http/http1/header_formatter.cc
Line
Count
Source
1
#include "source/common/http/http1/header_formatter.h"
2
3
#include <string>
4
5
namespace Envoy {
6
namespace Http {
7
namespace Http1 {
8
479
std::string ProperCaseHeaderKeyFormatter::format(absl::string_view key) const {
9
479
  auto copy = std::string(key);
10
11
479
  bool should_capitalize = true;
12
126k
  for (char& c : copy) {
13
126k
    if (should_capitalize && isalpha(c)) {
14
3.21k
      c = static_cast<char>(toupper(c));
15
3.21k
    }
16
17
126k
    should_capitalize = !isalpha(c) && !isdigit(c);
18
126k
  }
19
20
479
  return copy;
21
479
}
22
} // namespace Http1
23
} // namespace Http
24
} // namespace Envoy