Getting values of json from POST payload not working
Hi Guys,
strange behaviour down here. I'm trying to extract value of parameters from the payload of a POST and send with HSL using the below irule with no success at all: the variables are empty.
Can anyone tell me what's wrong with it?
when HTTP_REQUEST {
set hsl [HSL::open -proto UDP -pool HSL]
set uri [HTTP::uri]
set ip [IP::client_addr]
if {[HTTP::uri] contains "keepal"} {
set data [HTTP::payload]
set namevals [split [HTTP::payload] "&"]
set a 0
set b 0
set c 0
set d 0
for {set i 0} {$i < [llength $namevals]} {incr i} {
set params [split [lindex $namevals $i] "="]
if { [lindex $params 0] equals "parA" } {
set a [lindex $params 1]
}
if { [lindex $params 0] equals "parB" } {
set b [lindex $params 1]
}
if { [lindex $params 0] equals "parC" } {
set C [lindex $params 1]
}
if { [lindex $params 0] equals "parD" } {
set d [lindex $params 1]
}
}
HSL::send $hsl "$ip|$a|$b|$c|$d"
}
}
}