Add another debug point.

This commit is contained in:
Andrea Dell'Amico 2022-10-24 11:18:22 +02:00
parent cb824913b2
commit 947c9fa267
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,7 @@ function log(c, s){
} }
function debug(c, s){ function debug(c, s){
return {{ nginx_pep_debug_enabled }} ? c.request.error(s) : null return {{ nginx_pep_debug_enabled | lower }} ? c.request.error(s) : null
} }
function enforce(r) { function enforce(r) {
@ -45,7 +45,8 @@ function enforce(r) {
debug(context, "[REL] response status: " + reply.status) debug(context, "[REL] response status: " + reply.status)
closeAccountingRecord(context.record, (reply.status === 200 || reply.status === 201 || reply.status === 204)) closeAccountingRecord(context.record, (reply.status === 200 || reply.status === 201 || reply.status === 204))
context.request.subrequest("/_accounting", { detached : true, body : JSON.stringify(context.record) }) context.request.subrequest("/_accounting", { detached : true, body : JSON.stringify(context.record) })
r.return(reply.status, reply.responseBuffer) debug(njs.dump(reply))
r.return(reply.status, reply.responseText)
}).catch(e => { log(context, "Error .... " + njs.dump(e)); context.request.return(e.message === "Unauthorized" ? 403 : 500)} ) }).catch(e => { log(context, "Error .... " + njs.dump(e)); context.request.return(e.message === "Unauthorized" ? 403 : 500)} )
return return