mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::rfc3986: Type checking on form encoding from json::members.
This commit is contained in:
parent
6de17431ff
commit
086f92f989
1 changed files with 8 additions and 0 deletions
|
@ -216,6 +216,14 @@ ircd::rfc3986::encode(const mutable_buffer &out,
|
|||
window_buffer buf{out};
|
||||
const auto append{[&buf](const json::member &member)
|
||||
{
|
||||
assert(type(member.first) == json::STRING);
|
||||
if(unlikely(!member.second.serial && type(member.second) != json::STRING))
|
||||
throw assertive
|
||||
{
|
||||
"Cannot encode non-serial json::member type '%s'",
|
||||
reflect(type(member.second))
|
||||
};
|
||||
|
||||
consume(buf, size(encode(buf, member.first)));
|
||||
consume(buf, copy(buf, "="_sv));
|
||||
consume(buf, size(encode(buf, member.second)));
|
||||
|
|
Loading…
Reference in a new issue