mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 07:20:55 +01:00
modules/federation: Explicit path parameter checking for clearer error msgs.
This commit is contained in:
parent
7e8f3048d3
commit
476f198075
7 changed files with 37 additions and 1 deletions
|
@ -67,6 +67,12 @@ resource::response
|
||||||
get__backfill(client &client,
|
get__backfill(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
|
if(request.parv.size() < 1)
|
||||||
|
throw m::NEED_MORE_PARAMS
|
||||||
|
{
|
||||||
|
"room_id path parameter required"
|
||||||
|
};
|
||||||
|
|
||||||
m::room::id::buf room_id
|
m::room::id::buf room_id
|
||||||
{
|
{
|
||||||
url::decode(room_id, request.parv[0])
|
url::decode(room_id, request.parv[0])
|
||||||
|
|
|
@ -63,6 +63,12 @@ resource::response
|
||||||
get__backfill_ids(client &client,
|
get__backfill_ids(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
|
if(request.parv.size() < 1)
|
||||||
|
throw m::NEED_MORE_PARAMS
|
||||||
|
{
|
||||||
|
"room_id path parameter required"
|
||||||
|
};
|
||||||
|
|
||||||
m::room::id::buf room_id
|
m::room::id::buf room_id
|
||||||
{
|
{
|
||||||
url::decode(room_id, request.parv[0])
|
url::decode(room_id, request.parv[0])
|
||||||
|
|
|
@ -33,6 +33,12 @@ resource::response
|
||||||
handle_get(client &client,
|
handle_get(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
|
if(request.parv.size() < 1)
|
||||||
|
throw m::NEED_MORE_PARAMS
|
||||||
|
{
|
||||||
|
"event_id path parameter required."
|
||||||
|
};
|
||||||
|
|
||||||
m::event::id::buf event_id
|
m::event::id::buf event_id
|
||||||
{
|
{
|
||||||
url::decode(event_id, request.parv[0])
|
url::decode(event_id, request.parv[0])
|
||||||
|
|
|
@ -93,6 +93,12 @@ resource::response
|
||||||
handle_put(client &client,
|
handle_put(client &client,
|
||||||
const resource::request::object<m::txn> &request)
|
const resource::request::object<m::txn> &request)
|
||||||
{
|
{
|
||||||
|
if(request.parv.size() < 1)
|
||||||
|
throw m::NEED_MORE_PARAMS
|
||||||
|
{
|
||||||
|
"txn_id path parameter required"
|
||||||
|
};
|
||||||
|
|
||||||
const auto txn_id
|
const auto txn_id
|
||||||
{
|
{
|
||||||
request.parv[0]
|
request.parv[0]
|
||||||
|
|
|
@ -37,6 +37,12 @@ resource::response
|
||||||
get__state(client &client,
|
get__state(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
|
if(request.parv.size() < 1)
|
||||||
|
throw m::NEED_MORE_PARAMS
|
||||||
|
{
|
||||||
|
"room_id path parameter required"
|
||||||
|
};
|
||||||
|
|
||||||
m::room::id::buf room_id
|
m::room::id::buf room_id
|
||||||
{
|
{
|
||||||
url::decode(room_id, request.parv[0])
|
url::decode(room_id, request.parv[0])
|
||||||
|
|
|
@ -30,6 +30,12 @@ resource::response
|
||||||
get__state_ids(client &client,
|
get__state_ids(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
|
if(request.parv.size() < 1)
|
||||||
|
throw m::NEED_MORE_PARAMS
|
||||||
|
{
|
||||||
|
"room_id path parameter required"
|
||||||
|
};
|
||||||
|
|
||||||
m::room::id::buf room_id
|
m::room::id::buf room_id
|
||||||
{
|
{
|
||||||
url::decode(room_id, request.parv[0])
|
url::decode(room_id, request.parv[0])
|
||||||
|
|
|
@ -51,7 +51,7 @@ get__user_devices(client &client,
|
||||||
|
|
||||||
m::user::id::buf user_id
|
m::user::id::buf user_id
|
||||||
{
|
{
|
||||||
url::decode(user_id, request.parv[1])
|
url::decode(user_id, request.parv[0])
|
||||||
};
|
};
|
||||||
|
|
||||||
return resource::response
|
return resource::response
|
||||||
|
|
Loading…
Reference in a new issue