Stuck on some branching logic in a Studio snippet. I’m trying to route a call based on a flag returned from an internal API. The API returns a simple JSON payload with a boolean isPriority field.
Here’s the snippet code:
// Call the endpoint
GetRESTProxy("checkPriority", "https://internal-api.com/check", "GET", "", "", "")
// Assign the result
ASSIGN("priorityFlag", GetRESTProxy("checkPriority", "response", "isPriority"))
// Check the flag
IF("priorityFlag" == "true")
// Route to priority queue
ELSE
// Route to standard queue
END_IF
The issue is the IF block always falls to the ELSE branch, even when the API returns true. I’ve added a debug log to print priorityFlag right before the IF statement, and it shows true in the logs. But the comparison "priorityFlag" == "true" evaluates to false.
I’ve tried:
- Changing the comparison to
"priorityFlag" == true(without quotes) - Using
IF("priorityFlag")directly - Converting the value to a string explicitly in the API response
Nothing works. The Studio editor doesn’t throw any syntax errors, but the logic just doesn’t hold. Is there a specific way Studio handles boolean types from REST xies? Or is there a hidden type conversion I’m missing?
Also, the GET request works fine in Postman, so it’s not an auth issue. Just the Studio evaluation part. Any ideas?