diff options
author | Alex Vakulenko <avakulenko@google.com> | 2016-03-23 07:28:45 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-03-23 07:28:45 +0000 |
commit | aef812f9650bfeb5b6b1e1283c6db89a428ca8b5 (patch) | |
tree | 03833bb9609894d0e1ad180551f35b032d7c678c | |
parent | b555bc81314cda6e499c69481bf5f7c4cecfcd89 (diff) | |
parent | 29dd1605f71fbbe2f6281f67fa2dcc70737c13c1 (diff) | |
download | webservd-aef812f9650bfeb5b6b1e1283c6db89a428ca8b5.tar.gz |
libwebserv: Fix mock Response object to be used in unit tests
am: 29dd160
* commit '29dd1605f71fbbe2f6281f67fa2dcc70737c13c1':
libwebserv: Fix mock Response object to be used in unit tests
-rw-r--r-- | libwebserv/response.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libwebserv/response.h b/libwebserv/response.h index f330839..c890e72 100644 --- a/libwebserv/response.h +++ b/libwebserv/response.h @@ -53,30 +53,29 @@ class LIBWEBSERV_EXPORT Response { const std::string& mime_type) = 0; // Reply with text body. - void ReplyWithText(int status_code, - const std::string& text, - const std::string& mime_type); + virtual void ReplyWithText(int status_code, + const std::string& text, + const std::string& mime_type); // Reply with JSON object. The content type will be "application/json". - void ReplyWithJson(int status_code, const base::Value* json); + virtual void ReplyWithJson(int status_code, const base::Value* json); // Special form for JSON response for simple objects that have a flat // list of key-value pairs of string type. - void ReplyWithJson(int status_code, - const std::map<std::string, - std::string>& json); + virtual void ReplyWithJson(int status_code, + const std::map<std::string, std::string>& json); // Issue a redirect response, so the client browser loads a page at // the URL specified in |redirect_url|. If this is not an external URL, // it must be an absolute path starting at the root "/...". - void Redirect(int status_code, const std::string& redirect_url); + virtual void Redirect(int status_code, const std::string& redirect_url); // Send a plain text response (with no Content-Type header). // Usually used with error responses. |error_text| must be plain text. - void ReplyWithError(int status_code, const std::string& error_text); + virtual void ReplyWithError(int status_code, const std::string& error_text); // Send "404 Not Found" response. - void ReplyWithErrorNotFound(); + virtual void ReplyWithErrorNotFound(); }; } // namespace libwebserv |