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)17void 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) const21bool 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