Remove BooleanPrefMember usage from Data Reduction Proxy IO classes.
[chromium-blink-merge.git] / net / server / http_server_response_info.h
blobbbb76d8836d291130343c3c467680b304b2d2023
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
6 #define NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
8 #include <string>
9 #include <utility>
10 #include <vector>
12 #include "net/http/http_status_code.h"
14 namespace net {
16 class HttpServerResponseInfo {
17 public:
18 // Creates a 200 OK HttpServerResponseInfo.
19 HttpServerResponseInfo();
20 explicit HttpServerResponseInfo(HttpStatusCode status_code);
21 ~HttpServerResponseInfo();
23 static HttpServerResponseInfo CreateFor404();
24 static HttpServerResponseInfo CreateFor500(const std::string& body);
26 void AddHeader(const std::string& name, const std::string& value);
28 // This also adds an appropriate Content-Length header.
29 void SetBody(const std::string& body, const std::string& content_type);
30 // Sets content-length and content-type. Body should be sent separately.
31 void SetContentHeaders(size_t content_length,
32 const std::string& content_type);
34 std::string Serialize() const;
36 HttpStatusCode status_code() const;
37 const std::string& body() const;
39 private:
40 typedef std::vector<std::pair<std::string, std::string> > Headers;
42 HttpStatusCode status_code_;
43 Headers headers_;
44 std::string body_;
47 } // namespace net
49 #endif // NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_