diff options
author | Jaeseung Ha <ipknhama@gmail.com> | 2017-09-18 00:43:42 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-18 00:43:42 +0900 |
commit | 08acc7c0bedc24bf5b8c6cc01f1701b0d45e141e (patch) | |
tree | 77aa4aa0f2cbfd139dc3194a3cf113ed2100454f /examples/example.cpp | |
parent | e40605da59e368be524dee0e9e9d41ef05149473 (diff) | |
parent | 194a9ef6812e3d5476419e33be2756ab69fc0696 (diff) | |
download | crow-08acc7c0bedc24bf5b8c6cc01f1701b0d45e141e.tar.gz crow-08acc7c0bedc24bf5b8c6cc01f1701b0d45e141e.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()}; }); |