mod_rest/mod_rest.lua
changeset 3930 f77ae9685eb6
parent 3929 7dec5d096bb8
child 3933 bd687d586a8a
equal deleted inserted replaced
3929:7dec5d096bb8 3930:f77ae9685eb6
   159 	};
   159 	};
   160 	module:log("debug", "Received[rest]: %s", payload:top_tag());
   160 	module:log("debug", "Received[rest]: %s", payload:top_tag());
   161 	local send_type = decide_type((request.headers.accept or "") ..",".. request.headers.content_type)
   161 	local send_type = decide_type((request.headers.accept or "") ..",".. request.headers.content_type)
   162 	if payload.name == "iq" then
   162 	if payload.name == "iq" then
   163 		function origin.send(stanza)
   163 		function origin.send(stanza)
   164 			prosody.core_route_stanza(nil, stanza);
   164 			module:send(stanza);
   165 		end
   165 		end
   166 		if payload.attr.type ~= "get" and payload.attr.type ~= "set" then
   166 		if payload.attr.type ~= "get" and payload.attr.type ~= "set" then
   167 			return errors.new({ code = 422, text = "'iq' stanza must be of type 'get' or 'set'" });
   167 			return errors.new({ code = 422, text = "'iq' stanza must be of type 'get' or 'set'" });
   168 		elseif #payload.tags ~= 1 then
   168 		elseif #payload.tags ~= 1 then
   169 			return errors.new({ code = 422, text = "'iq' stanza must have exactly one child tag" });
   169 			return errors.new({ code = 422, text = "'iq' stanza must have exactly one child tag" });