mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 16:33:53 +01:00
ircd: Add resource response json::iov related conversions for members lists.
This commit is contained in:
parent
cd535b416b
commit
d3feb23a25
2 changed files with 22 additions and 0 deletions
|
@ -93,6 +93,8 @@ struct ircd::resource::response
|
|||
response(client &, const string_view &str, const string_view &ct = "text/plain; charset=utf8", const http::code & = http::OK);
|
||||
response(client &, const json::object & = "{}", const http::code & = http::OK);
|
||||
response(client &, const json::iov &, const http::code & = http::OK);
|
||||
response(client &, const json::members &, const http::code & = http::OK);
|
||||
response(client &, const http::code &, const json::members &);
|
||||
response(client &, const http::code &, const json::iov &);
|
||||
response(client &, const http::code &);
|
||||
response() = default;
|
||||
|
|
|
@ -247,6 +247,26 @@ ircd::resource::response::response(client &client,
|
|||
{
|
||||
}
|
||||
|
||||
ircd::resource::response::response(client &client,
|
||||
const json::members &members,
|
||||
const http::code &code)
|
||||
:response{client, code, members}
|
||||
{
|
||||
}
|
||||
|
||||
ircd::resource::response::response(client &client,
|
||||
const http::code &code,
|
||||
const json::members &members)
|
||||
{
|
||||
size_t i(0);
|
||||
json::iov iov;
|
||||
json::iov::push nodes[members.size()];
|
||||
for(const auto &member : members)
|
||||
new (nodes + i++) json::iov::push(iov, member);
|
||||
|
||||
response(client, iov, code);
|
||||
}
|
||||
|
||||
ircd::resource::response::response(client &client,
|
||||
const http::code &code)
|
||||
:response{client, json::object{"{}"}, code}
|
||||
|
|
Loading…
Reference in a new issue