xref: /aosp_15_r20/external/cronet/net/http/http_response_headers_test_util.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2023 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 #ifndef NET_HTTP_HTTP_RESPONSE_HEADERS_TEST_UTIL_H_
6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_TEST_UTIL_H_
7 
8 #include <string>
9 
10 #include "base/memory/ref_counted.h"
11 
12 namespace net {
13 
14 class HttpResponseHeaders;
15 
16 namespace test {
17 
18 // Returns a simple text serialization of the HttpResponseHeaders object
19 // `parsed`. This is used by tests to verify that the object matches an
20 // expectation string.
21 //
22 //  * One line per header, written as:
23 //        HEADER_NAME: HEADER_VALUE\n
24 //  * The original case of header names is preserved.
25 //  * Whitespace around head names/values is stripped.
26 //  * Repeated headers are not aggregated.
27 //  * Headers are listed in their original order.
28 std::string HttpResponseHeadersToSimpleString(
29     const scoped_refptr<HttpResponseHeaders>& parsed);
30 
31 }  // namespace test
32 
33 }  // namespace net
34 
35 #endif  // NET_HTTP_HTTP_RESPONSE_HEADERS_TEST_UTIL_H_
36