| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/server/http_server_response_info.h" | 5 #include "net/server/http_server_response_info.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "net/http/http_request_headers.h" | 9 #include "net/http/http_request_headers.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 HttpServerResponseInfo::HttpServerResponseInfo() : status_code_(HTTP_OK) {} | 13 HttpServerResponseInfo::HttpServerResponseInfo() : status_code_(HTTP_OK) { |
| 14 } |
| 14 | 15 |
| 15 HttpServerResponseInfo::HttpServerResponseInfo(HttpStatusCode status_code) | 16 HttpServerResponseInfo::HttpServerResponseInfo(HttpStatusCode status_code) |
| 16 : status_code_(status_code) {} | 17 : status_code_(status_code) { |
| 18 } |
| 17 | 19 |
| 18 HttpServerResponseInfo::~HttpServerResponseInfo() {} | 20 HttpServerResponseInfo::~HttpServerResponseInfo() { |
| 21 } |
| 19 | 22 |
| 20 // static | 23 // static |
| 21 HttpServerResponseInfo HttpServerResponseInfo::CreateFor404() { | 24 HttpServerResponseInfo HttpServerResponseInfo::CreateFor404() { |
| 22 HttpServerResponseInfo response(HTTP_NOT_FOUND); | 25 HttpServerResponseInfo response(HTTP_NOT_FOUND); |
| 23 response.SetBody(std::string(), "text/html"); | 26 response.SetBody(std::string(), "text/html"); |
| 24 return response; | 27 return response; |
| 25 } | 28 } |
| 26 | 29 |
| 27 // static | 30 // static |
| 28 HttpServerResponseInfo HttpServerResponseInfo::CreateFor500( | 31 HttpServerResponseInfo HttpServerResponseInfo::CreateFor500( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 | 61 |
| 59 HttpStatusCode HttpServerResponseInfo::status_code() const { | 62 HttpStatusCode HttpServerResponseInfo::status_code() const { |
| 60 return status_code_; | 63 return status_code_; |
| 61 } | 64 } |
| 62 | 65 |
| 63 const std::string& HttpServerResponseInfo::body() const { | 66 const std::string& HttpServerResponseInfo::body() const { |
| 64 return body_; | 67 return body_; |
| 65 } | 68 } |
| 66 | 69 |
| 67 } // namespace net | 70 } // namespace net |
| OLD | NEW |