Mercurial > prosody-modules
comparison mod_http_debug/mod_http_debug.lua @ 5333:10fcfa7e62a1
mod_http_debug: Module that echos back HTTP request info for debugging
Written in 2021 for debugging some reverse proxy issue on https://chat.prosody.im/
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 07 Apr 2023 21:10:14 +0200 |
parents | |
children | 91564b57e595 |
comparison
equal
deleted
inserted
replaced
5332:e0b5468aae49 | 5333:10fcfa7e62a1 |
---|---|
1 local json = require "util.json" | |
2 | |
3 module:depends("http") | |
4 module:provides("http", { | |
5 route = { | |
6 GET = function(event) | |
7 local request = event.request; | |
8 return { | |
9 status_code = 200; | |
10 headers = { | |
11 content_type = "application/json", | |
12 }, | |
13 body = json.encode { | |
14 body = request.body; | |
15 headers = request.headers; | |
16 httpversion = request.httpversion; | |
17 ip = request.ip; | |
18 method = request.method; | |
19 path = request.path; | |
20 secure = request.secure; | |
21 url = request.url; | |
22 } | |
23 } | |
24 end; | |
25 } | |
26 }) |