mod_rest: Stop search when an implied type is determined
authorKim Alvefur <zash@zash.se>
Thu, 04 Nov 2021 20:13:43 +0100
changeset 4748 f478855f4565
parent 4747 0a501df823fd
child 4749 d29a295cd165
mod_rest: Stop search when an implied type is determined Optimization only, as the iteration order is undefined. And not much since there's not that many entries in the implied_types map.
mod_rest/jsonmap.lib.lua
--- a/mod_rest/jsonmap.lib.lua	Thu Nov 04 20:04:13 2021 +0100
+++ b/mod_rest/jsonmap.lib.lua	Thu Nov 04 20:13:43 2021 +0100
@@ -478,6 +478,7 @@
 		for k, implied in pairs(implied_types) do
 			if t[k] then
 				t_type = implied;
+				break;
 			end
 		end
 	end