MCPcopy Create free account
hub / github.com/catboost/catboost / THttpResponse

Class THttpResponse

library/cpp/http/server/response.h:12–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10class IOutputStream;
11
12class THttpResponse {
13public:
14 THttpResponse() noexcept
15 : Code(HTTP_OK)
16 {
17 }
18
19 explicit THttpResponse(HttpCodes code) noexcept
20 : Code(code)
21 {
22 }
23
24 template <typename ValueType>
25 THttpResponse& AddHeader(const TString& name, const ValueType& value) {
26 return AddHeader(THttpInputHeader(name, ToString(value)));
27 }
28
29 THttpResponse& AddHeader(const THttpInputHeader& header) {
30 Headers.AddHeader(header);
31
32 return *this;
33 }
34
35 template <typename ValueType>
36 THttpResponse& AddOrReplaceHeader(const TString& name, const ValueType& value) {
37 return AddOrReplaceHeader(THttpInputHeader(name, ToString(value)));
38 }
39
40 THttpResponse& AddOrReplaceHeader(const THttpInputHeader& header) {
41 Headers.AddOrReplaceHeader(header);
42
43 return *this;
44 }
45
46 THttpResponse& AddMultipleHeaders(const THttpHeaders& headers);
47
48 const THttpHeaders& GetHeaders() const {
49 return Headers;
50 }
51
52 THttpResponse& SetContentType(const TStringBuf& contentType);
53
54 /**
55 * @note If @arg content isn't empty its size is automatically added as a
56 * "Content-Length" header during output to IOutputStream.
57 * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
58 */
59 THttpResponse& SetContent(const TString& content) {
60 Content = content;
61
62 return *this;
63 }
64
65 THttpResponse& SetContent(TString&& content) {
66 Content = std::move(content);
67
68 return *this;
69 }

Callers

nothing calls this directly

Calls 5

THttpInputHeaderClass · 0.85
ToStringFunction · 0.50
moveFunction · 0.50
AddHeaderMethod · 0.45
AddOrReplaceHeaderMethod · 0.45

Tested by

no test coverage detected