diff --git a/src/tawashi/response.cpp b/src/tawashi/response.cpp index 716c9ee..eccd283 100644 --- a/src/tawashi/response.cpp +++ b/src/tawashi/response.cpp @@ -217,6 +217,10 @@ namespace tawashi { return *m_cgi_env; } + cgi::PostMapType Response::cgi_post() const { + return cgi::read_post(std::cin, cgi_env(), settings().as("max_post_size")); + } + const std::string& Response::base_uri() const { return m_base_uri; } diff --git a/src/tawashi/response.hpp b/src/tawashi/response.hpp index 3edc5f7..b5c74d1 100644 --- a/src/tawashi/response.hpp +++ b/src/tawashi/response.hpp @@ -22,6 +22,7 @@ #include "http_header.hpp" #include "error_reasons.hpp" #include "storage.hpp" +#include "cgi_post.hpp" #include #include #include @@ -49,6 +50,8 @@ namespace tawashi { ); const cgi::Env& cgi_env() const; + tawashi_virtual_testing cgi::PostMapType cgi_post() const; + const std::string& base_uri() const; virtual boost::string_ref page_basename() const = 0; tawashi_virtual_testing const Storage& storage() const; diff --git a/src/tawashi/submit_paste_response.cpp b/src/tawashi/submit_paste_response.cpp index df92aa6..62fd531 100644 --- a/src/tawashi/submit_paste_response.cpp +++ b/src/tawashi/submit_paste_response.cpp @@ -92,7 +92,7 @@ namespace tawashi { const SettingsBag& settings = this->settings(); try { - auto post = cgi::read_post(std::cin, cgi_env(), settings.as("max_post_size")); + auto post = this->cgi_post(); pastie = get_value_from_post(post, make_string_ref(g_post_key)); lang = get_value_from_post_log_failure(post, make_string_ref(g_language_key)); duration = get_value_from_post_log_failure(post, make_string_ref(g_duration_key));