feat: add 'force_forward' field to request (#1647)

Fix #1141
This commit is contained in:
cyan317
2024-09-17 11:42:51 +01:00
committed by GitHub
parent bea905adcd
commit 0282504f18
2 changed files with 159 additions and 221 deletions

View File

@@ -69,6 +69,9 @@ public:
if (specifiesCurrentOrClosedLedger(request))
return true;
if (isForcedForward(ctx))
return true;
auto const checkAccountInfoForward = [&]() {
return ctx.method == "account_info" and request.contains("queue") and request.at("queue").is_bool() and
request.at("queue").as_bool();
@@ -138,6 +141,14 @@ private:
{
return handlerProvider_->contains(method) || isProxied(method);
}
bool
isForcedForward(web::Context const& ctx) const
{
static constexpr auto FORCE_FORWARD = "force_forward";
return ctx.isAdmin and ctx.params.contains(FORCE_FORWARD) and ctx.params.at(FORCE_FORWARD).is_bool() and
ctx.params.at(FORCE_FORWARD).as_bool();
}
};
} // namespace rpc::impl