Forum Discussion
Chado
Nimbostratus
Oct 18, 2020Inspect JSON request payload
First off, I am not a developer. I have limited experience with iRules. I got task to write an iRule to inspect JSON requests containing specific type parameters in its payload. If the payload contai...
Yoann_Le_Corvi1
Cumulonimbus
Oct 18, 2020Hi
Here is a code snippet that might help. Keep in mind this is not a full fledge JSON parser though.
set payload "[string map {"\"" ""} [string trim $jsonRequestPayload "\{\}"]]"
for each parameter [split $payload ","] {
switch -glob -- $parameter {
"type:*" {
set type [ lindex [split $parameter ":"] 1 ]
if { $type equals "wrongtype" } {
HTTP::respond 404 content "Not Found"
}
}
}Hope this may help.
Yoann
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
