mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-06 10:57:50 +08:00
http api请求有json body才解析
This commit is contained in:
parent
0ead9b6945
commit
725fdf1786
@ -225,16 +225,18 @@ ApiArgsType getAllArgs(const Parser &parser) {
|
|||||||
allArgs[pr.first] = strCoding::UrlDecodeComponent(pr.second);
|
allArgs[pr.first] = strCoding::UrlDecodeComponent(pr.second);
|
||||||
}
|
}
|
||||||
} else if (parser["Content-Type"].find("application/json") == 0) {
|
} else if (parser["Content-Type"].find("application/json") == 0) {
|
||||||
try {
|
if (!parser.content().empty()) {
|
||||||
stringstream ss(parser.content());
|
try {
|
||||||
Value jsonArgs;
|
stringstream ss(parser.content());
|
||||||
ss >> jsonArgs;
|
Value jsonArgs;
|
||||||
auto keys = jsonArgs.getMemberNames();
|
ss >> jsonArgs;
|
||||||
for (auto key = keys.begin(); key != keys.end(); ++key) {
|
auto keys = jsonArgs.getMemberNames();
|
||||||
allArgs[*key] = jsonArgs[*key].asString();
|
for (auto key = keys.begin(); key != keys.end(); ++key) {
|
||||||
|
allArgs[*key] = jsonArgs[*key].asString();
|
||||||
|
}
|
||||||
|
} catch (std::exception &ex) {
|
||||||
|
WarnL << ex.what();
|
||||||
}
|
}
|
||||||
} catch (std::exception &ex) {
|
|
||||||
WarnL << ex.what();
|
|
||||||
}
|
}
|
||||||
} else if (!parser["Content-Type"].empty()) {
|
} else if (!parser["Content-Type"].empty()) {
|
||||||
WarnL << "invalid Content-Type:" << parser["Content-Type"];
|
WarnL << "invalid Content-Type:" << parser["Content-Type"];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user