#include <nawa/request/GPC/ext/Post.h>
Inherits nawa::request::GPC.
Specialized accessor for POST that also allows accessing files (and in future, maybe, the raw POST data).
Definition at line 36 of file Post.h.
◆ ~Post()
nawa::request::Post::~Post |
( |
| ) |
|
|
override |
◆ Post()
◆ operator bool()
request::Post::operator bool |
( |
| ) |
const |
|
explicitoverridevirtual |
Shortcut to check for the existence of POST values (including files).
- Returns
- True if POST values are available.
Reimplemented from nawa::request::GPC.
Definition at line 46 of file Post.cpp.
◆ getRaw()
shared_ptr< std::string const > request::Post::getRaw |
( |
| ) |
const |
Get the raw POST data (availability may depend on the raw_access setting in the config).
- Returns
- Shared pointer to a string containing the raw POST data if available, otherwise the shared_ptr does not contain an object.
Definition at line 50 of file Post.cpp.
◆ getContentType()
std::string request::Post::getContentType |
( |
| ) |
const |
Get the POST content type as submitted by the browser
- Returns
- String containing the POST content type
Definition at line 54 of file Post.cpp.
◆ hasFiles()
bool request::Post::hasFiles |
( |
| ) |
const |
Check whether files have been uploaded via POST.
- Returns
- True if files have been uploaded via POST.
Definition at line 58 of file Post.cpp.
◆ getFile()
std::optional< File > request::Post::getFile |
( |
std::string const & |
key | ) |
const |
Get a file submitted via POST. If the query contains more than one POST file of the same name, only one of them (usually the first definition) will be returned. For accessing all definitions, please use getFileVector(). Complexity is logarithmic, so if you want to access a value multiple times, saving it in a variable is a good idea.
- Parameters
-
- Returns
- The file if available. Nullopt if no file with the given key has been submitted.
Definition at line 62 of file Post.cpp.
◆ getFileVector()
std::vector< File > request::Post::getFileVector |
( |
std::string const & |
key | ) |
const |
Get all POST files with the given key.
- Parameters
-
- Returns
- Vector of files. Empty if no file with the given key exists.
Definition at line 69 of file Post.cpp.
◆ countFiles()
size_t request::Post::countFiles |
( |
std::string const & |
key | ) |
const |
Get the number of submitted POST files with the given key.
- Parameters
-
- Returns
- Number of occurrences.
Definition at line 78 of file Post.cpp.
◆ getFileMultimap()
std::unordered_multimap< std::string, File > const & request::Post::getFileMultimap |
( |
| ) |
const |
Get a reference to the POST file multimap.
- Returns
- Reference to the multimap.
Definition at line 82 of file Post.cpp.
The documentation for this class was generated from the following files: