# HG changeset patch # User Kim Alvefur # Date 1649457798 -7200 # Node ID 816b23e09c202f1d697a2f07a8f945a067656d98 # Parent bdac7c717c915ad4a419c990337f829526008927 mod_rest: Improve logging of results from callback startup probe Especially interested in logging 500 status codes and their errors, to diagnose problems with the callback API. diff -r bdac7c717c91 -r 816b23e09c20 mod_rest/mod_rest.lua --- a/mod_rest/mod_rest.lua Sat Apr 09 00:41:18 2022 +0200 +++ b/mod_rest/mod_rest.lua Sat Apr 09 00:43:18 2022 +0200 @@ -435,13 +435,16 @@ method = "OPTIONS", }, function (body, code, response) if code == 0 then - return module:log_status("error", "Could not connect to callback URL %q: %s", rest_url, body); - else + module:log_status("error", "Could not connect to callback URL %q: %s", rest_url, body); + elseif code == 200 then module:set_status("info", "Connected"); - end - if code == 200 and response.headers.accept then - send_type = decide_type(response.headers.accept, supported_outputs); - module:log("debug", "Set 'rest_callback_content_type' = %q based on Accept header", send_type); + if response.headers.accept then + send_type = decide_type(response.headers.accept, supported_outputs); + module:log("debug", "Set 'rest_callback_content_type' = %q based on Accept header", send_type); + end + else + module:log_status("warn", "Unexpected response code %d from OPTIONS probe", code); + module:log("warn", "Endpoint said: %s", body); end end);