aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJaeseung Ha <ipknhama@gmail.com>2017-09-17 13:50:50 +0900
committerGitHub <noreply@github.com>2017-09-17 13:50:50 +0900
commit13fdc9390be442a0a9d9ffe37cf63c729bfeaf3e (patch)
treef12829eec022aca042bf0664bb7132445b27227b /examples
parent16064ec9ba04266655e3474b687f2d53472fcc4c (diff)
parent15d377907fd8b63e2d8474dfeeeb1765fd8b729d (diff)
downloadcrow-13fdc9390be442a0a9d9ffe37cf63c729bfeaf3e.tar.gz
crow-13fdc9390be442a0a9d9ffe37cf63c729bfeaf3e.zip
Merge pull request #202 from Rasie1/master
Conflict with std namespace
Diffstat (limited to 'examples')
-rw-r--r--examples/example.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/example.cpp b/examples/example.cpp
index b4cbe40..87231a2 100644
--- a/examples/example.cpp
+++ b/examples/example.cpp
@@ -146,6 +146,15 @@ int main()
for(const auto& countVal : count) {
os << " - " << countVal << '\n';
}
+
+ // To get a dictionary from the request
+ // You have to submit something like '/params?mydict[a]=b&mydict[abcd]=42' to have a list of pairs ((a, b) and (abcd, 42))
+ auto mydict = req.url_params.get_dict("mydict");
+ os << "The key 'dict' contains " << mydict.size() << " value(s).\n";
+ for(const auto& mydictVal : mydict) {
+ os << " - " << mydictVal.first << " -> " << mydictVal.second << '\n';
+ }
+
return crow::response{os.str()};
});