impl(rest): improve http header representation#16058
impl(rest): improve http header representation#16058scotthart wants to merge 3 commits intogoogleapis:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the HttpHeaderName class to handle case-insensitive HTTP header names by storing them in lowercase and refactors HttpHeader, RestContext, and RestRequest to use this new type along with absl::flat_hash_map for header storage. Feedback identifies opportunities to improve efficiency by removing redundant lowercase conversions in HttpHeader comparison and key-checking methods, and suggests using explicit HttpHeader construction in tests to improve clarity.
83fe4c2 to
d39ef3b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #16058 +/- ##
==========================================
- Coverage 92.69% 92.69% -0.01%
==========================================
Files 2343 2343
Lines 216541 216598 +57
==========================================
+ Hits 200729 200781 +52
- Misses 15812 15817 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Using plain
std::stringto represent HTTP headers, particularly the header names, requires all code locations to deal with the mismatch betweenstd::stringbeing case-sensitive and HTTP header names being case-insensitive. This PR extends the use of theHttpHeadertype and introduces theHttpHeaderNametype to consolidate such code. Additionally, it updates the definition of a collection ofHttpHeaderobjects inHttpHeaders.