Fix build break
[chromium-blink-merge.git] / chrome / browser / google_apis / test_server / http_response.h
bloba73fdb0aeb5495c5946413c8344c3f279cd4bfce
1 // Copyright (c) 2012 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 CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_RESPONSE_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_RESPONSE_H_
8 #include <map>
9 #include <string>
11 #include "base/basictypes.h"
13 namespace google_apis {
14 namespace test_server {
16 enum ResponseCode {
17 SUCCESS = 200,
18 CREATED = 201,
19 NO_CONTENT = 204,
20 MOVED = 301,
21 RESUME_INCOMPLETE = 308,
22 NOT_FOUND = 404,
23 PRECONDITION = 412,
24 ACCESS_DENIED = 500,
27 // Respresents a HTTP response. Since it can be big, it may be better to use
28 // scoped_ptr to pass it instead of copying.
29 class HttpResponse {
30 public:
31 HttpResponse();
32 ~HttpResponse();
34 // The response code.
35 ResponseCode code() const { return code_; }
36 void set_code(ResponseCode code) { code_ = code; }
38 // The content of the response.
39 const std::string& content() const { return content_; }
40 void set_content(const std::string& content) { content_ = content; }
42 // The content type.
43 const std::string& content_type() const { return content_type_; }
44 void set_content_type(const std::string& content_type) {
45 content_type_ = content_type;
48 // The custom headers to be sent to the client.
49 const std::map<std::string, std::string>& custom_headers() const {
50 return custom_headers_;
53 // Adds a custom header.
54 void AddCustomHeader(const std::string& key, const std::string& value) {
55 custom_headers_[key] = value;
58 // Generates and returns a http response string.
59 std::string ToResponseString() const;
61 private:
62 ResponseCode code_;
63 std::string content_;
64 std::string content_type_;
65 std::map<std::string, std::string> custom_headers_;
68 } // namespace test_servers
69 } // namespace google_apis
71 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_RESPONSE_H_