0
0
Fork 0
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:
Jason Volk 2018-12-06 17:31:22 -08:00
parent 6de17431ff
commit 086f92f989

View file

@ -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)));