Changeset

3885:1ec45dbc7db5

mod_rest: Return an error for unknown fields in JSON input Helps you discover typos and such.
author Kim Alvefur <zash@zash.se>
date Fri, 07 Feb 2020 20:49:07 +0100
parents 3884:f84ede3e9e3b
children 3886:b64b08b7bf8e
files mod_rest/jsonmap.lib.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Thu Feb 06 21:03:17 2020 +0000
+++ b/mod_rest/jsonmap.lib.lua	Fri Feb 07 20:49:07 2020 +0100
@@ -464,6 +464,8 @@
 			elseif typ[1] == "func" then
 				s:add_child(typ[5](v)):up();
 			end
+		else
+			return nil, "unknown-field";
 		end
 	end