refactor: add unified gatherArgument helper for request parsing

This commit is contained in:
2026-07-16 10:01:10 +03:00
parent 5df8da3a60
commit db11d7a4d9
3 changed files with 10 additions and 7 deletions
+7
View File
@@ -28,4 +28,11 @@ PIHTTP::MessageMutable noContent() {
return msg;
}
PIString gatherArgument(const PIHTTP::MessageConst & request, const PIString & key) {
PIJSON js = PIJSON::fromJSON(PIString::fromUTF8(request.body()));
if (js.contains(key)) return js[key].toString();
if (request.arguments().contains(key)) return request.arguments().value(key);
return {};
}
} // namespace MessageUtils