Skip to content

Commit

Permalink
repo-sync-2024-10-11T17:00:27+0800
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeTheByRiver committed Oct 11, 2024
1 parent 5c9ad00 commit 095ec1d
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,20 @@ Http::FilterHeadersStatus HeaderDecoratorFilter::decodeHeaders(Http::RequestHead
}

void HeaderDecoratorFilter::appendHeaders(Http::RequestHeaderMap& headers) const {
auto source = KusciaHeader::getSource(headers).value_or("");
// get original source header
auto source_header = headers.get(KusciaCommon::HeaderKeyOriginSource);
if (source_header.empty()) {
source_header = headers.get(KusciaCommon::HeaderKeyKusciaSource);
}
std::string source;
if (!source_header.empty()) {
source = source_header[0]->value().getStringView();
}
// overwrite headers if exists
auto iter = append_headers_.find(source);
if (iter != append_headers_.end()) {
for (const auto& entry : iter->second) {
headers.addCopy(Http::LowerCaseString(entry.first), entry.second);
headers.setCopy(Http::LowerCaseString(entry.first), entry.second);
}
}
}
Expand Down

0 comments on commit 095ec1d

Please sign in to comment.