mod_rest: Default to replying with same type as request
If you send JSON then you get JSON back unless you say something
different with the Accept header.
--- a/mod_rest/mod_rest.lua Wed Jan 01 16:37:18 2020 +0100
+++ b/mod_rest/mod_rest.lua Wed Jan 01 16:40:10 2020 +0100
@@ -102,7 +102,7 @@
["xml:lang"] = payload.attr["xml:lang"],
};
module:log("debug", "Received[rest]: %s", payload:top_tag());
- local send_type = decide_type(request.headers.accept)
+ local send_type = decide_type((request.headers.accept or "") ..",".. request.headers.content_type)
if payload.name == "iq" then
if payload.attr.type ~= "get" and payload.attr.type ~= "set" then
return errors.new({ code = 422, text = "'iq' stanza must be of type 'get' or 'set'" });