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:
parent
fb27563fdd
commit
4ba3b679fc
3 changed files with 8 additions and 1 deletions
|
@ -217,6 +217,10 @@ namespace tawashi {
|
||||||
return *m_cgi_env;
|
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 {
|
const std::string& Response::base_uri() const {
|
||||||
return m_base_uri;
|
return m_base_uri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "http_header.hpp"
|
#include "http_header.hpp"
|
||||||
#include "error_reasons.hpp"
|
#include "error_reasons.hpp"
|
||||||
#include "storage.hpp"
|
#include "storage.hpp"
|
||||||
|
#include "cgi_post.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/utility/string_ref.hpp>
|
#include <boost/utility/string_ref.hpp>
|
||||||
|
@ -49,6 +50,8 @@ namespace tawashi {
|
||||||
);
|
);
|
||||||
|
|
||||||
const cgi::Env& cgi_env() const;
|
const cgi::Env& cgi_env() const;
|
||||||
|
tawashi_virtual_testing cgi::PostMapType cgi_post() const;
|
||||||
|
|
||||||
const std::string& base_uri() const;
|
const std::string& base_uri() const;
|
||||||
virtual boost::string_ref page_basename() const = 0;
|
virtual boost::string_ref page_basename() const = 0;
|
||||||
tawashi_virtual_testing const Storage& storage() const;
|
tawashi_virtual_testing const Storage& storage() const;
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace tawashi {
|
||||||
|
|
||||||
const SettingsBag& settings = this->settings();
|
const SettingsBag& settings = this->settings();
|
||||||
try {
|
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));
|
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));
|
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));
|
duration = get_value_from_post_log_failure(post, make_string_ref(g_duration_key));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue