1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-08-03 12:50:02 +00:00

Read POST in the Response so I can override it for testing.

This commit is contained in:
King_DuckZ 2017-06-05 23:56:59 +01:00
parent fb27563fdd
commit 4ba3b679fc
3 changed files with 8 additions and 1 deletions

View file

@ -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<uint32_t>("max_post_size"));
}
const std::string& Response::base_uri() const {
return m_base_uri;
}

View file

@ -22,6 +22,7 @@
#include "http_header.hpp"
#include "error_reasons.hpp"
#include "storage.hpp"
#include "cgi_post.hpp"
#include <string>
#include <iostream>
#include <boost/utility/string_ref.hpp>
@ -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;

View file

@ -92,7 +92,7 @@ namespace tawashi {
const SettingsBag& settings = this->settings();
try {
auto post = cgi::read_post(std::cin, cgi_env(), settings.as<uint32_t>("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));