# HG changeset patch # User Kim Alvefur # Date 1580843949 -3600 # Node ID fea0c1bed1a05eb1fb0f4fdd72816dc6b9732e6c # Parent 513a8a7fab413b3bf3d95b9f2b21bcc622c41d35 mod_rest: Back out 513a8a7fab41 I see the mistake now > if true or ... diff -r 513a8a7fab41 -r fea0c1bed1a0 mod_rest/mod_rest.lua --- a/mod_rest/mod_rest.lua Mon Feb 03 23:09:38 2020 +0100 +++ b/mod_rest/mod_rest.lua Tue Feb 04 20:19:09 2020 +0100 @@ -315,19 +315,17 @@ end end -if module:get_option_boolean("rest_json_errors", false) then - local http_server = require "net.http.server"; - module:hook_object_event(http_server, "http-error", function (event) - local request, response = event.request, event.response; - if true or decide_type(request and request.headers.accept or "") == "application/json" then - if response then - response.headers.content_type = "application/json"; - end - return json.encode({ - type = "error", - error = event.error, - code = event.code, - }); +local http_server = require "net.http.server"; +module:hook_object_event(http_server, "http-error", function (event) + local request, response = event.request, event.response; + if true or decide_type(request and request.headers.accept or "") == "application/json" then + if response then + response.headers.content_type = "application/json"; end - end, 10); -end + return json.encode({ + type = "error", + error = event.error, + code = event.code, + }); + end +end, 10);