xref: /aosp_15_r20/external/cronet/net/http/http_raw_request_headers.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "net/http/http_raw_request_headers.h"
6 
7 #include <string_view>
8 
9 namespace net {
10 
11 HttpRawRequestHeaders::HttpRawRequestHeaders() = default;
12 HttpRawRequestHeaders::HttpRawRequestHeaders(HttpRawRequestHeaders&&) = default;
13 HttpRawRequestHeaders& HttpRawRequestHeaders::operator=(
14     HttpRawRequestHeaders&&) = default;
15 HttpRawRequestHeaders::~HttpRawRequestHeaders() = default;
16 
Add(std::string_view key,std::string_view value)17 void HttpRawRequestHeaders::Add(std::string_view key, std::string_view value) {
18   headers_.emplace_back(std::string(key), std::string(value));
19 }
20 
FindHeaderForTest(std::string_view key,std::string * value) const21 bool HttpRawRequestHeaders::FindHeaderForTest(std::string_view key,
22                                               std::string* value) const {
23   for (const auto& entry : headers_) {
24     if (entry.first == key) {
25       *value = entry.second;
26       return true;
27     }
28   }
29   return false;
30 }
31 
32 }  // namespace net
33