Pode
Pode copied to clipboard
Acessing request body using Custom logging method
Question
Hey there :wave:, I'm currently tweaking a custom log for my API and I've explored the raw hash-table provided by pode for a custom log on terminal.
I've saw the work done on https://github.com/Badgerati/Pode/issues/33, and it appears to be possible to access all proprieties on the request, but I'm not sure how to do it properly.
This is my current code:
$method = New-PodeLoggingMethod -Custom -ScriptBlock {
param($item)
"[REQUEST] HOST: $($item.Host) - STATUS: $($item.Response.StatusCode) - METHOD: $($item.Request.Method) - PROTOCOL: $($item.Request.Protocol) - AGENT: $($item.Request.Agent)" | Out-Default
}
$method | Enable-PodeRequestLogging -Raw
What I'm trying to do is Access one of the parameters on the request body, Is that possible? I'd like to do something like $($item.Request.Body.Channel) to access the Channel parameter form the request body.
Thank you for you attention and the overall development of PODE, it has been very useful on my projects.