Software /
code /
prosody-modules
Comparison
mod_http_debug/mod_http_debug.lua @ 5491:7842502c1157
mod_http_debug: Log some extended info about requests
If you point something external at this module, you don't get the
response body back, hence it can be useful to see some details in the
log as well.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 May 2023 15:37:15 +0200 |
parent | 5490:91564b57e595 |
child | 5492:b6af4d1ff8c1 |
comparison
equal
deleted
inserted
replaced
5490:91564b57e595 | 5491:7842502c1157 |
---|---|
1 local json = require "util.json" | 1 local json = require "util.json" |
2 | 2 |
3 module:depends("http") | 3 module:depends("http") |
4 local function handle_request(event) | 4 local function handle_request(event) |
5 local request = event.request; | 5 local request = event.request; |
6 (request.log or module._log)("debug", "%s -- %s %q HTTP/%s -- %q -- %s", request.ip, request.method, request.url, request.httpversion, request.headers, request.body); | |
6 return { | 7 return { |
7 status_code = 200; | 8 status_code = 200; |
8 headers = { content_type = "application/json" }; | 9 headers = { content_type = "application/json" }; |
9 host = module.host; | 10 host = module.host; |
10 body = json.encode { | 11 body = json.encode { |