diff options
author | Jaeseung Ha <ipknhama@gmail.com> | 2017-09-17 19:17:54 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-17 19:17:54 +0900 |
commit | d8c4a671760fda8e83279b9383108f0951367fb6 (patch) | |
tree | 0ad063878c09eec987d1d8054b66d11fd629ce30 /examples/example.cpp | |
parent | 26c4d5ddef6920043ae40a9d80ca31f3b820bad5 (diff) | |
parent | 414809c742521926ca08fbd355b92f3ae877064f (diff) | |
download | crow-d8c4a671760fda8e83279b9383108f0951367fb6.tar.gz crow-d8c4a671760fda8e83279b9383108f0951367fb6.zip |
Merge branch 'master' into master
Diffstat (limited to 'examples/example.cpp')
-rw-r--r-- | examples/example.cpp | 9 |
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()}; }); |