Hi, I'm trying to generate response(status and bod...
# help
m
Hi, I'm trying to generate response(status and body) based on a condition like below. if True the status will be 200 with "hello is present" as body or else if the condition fails. It fails with Cannot deserialize value of type
int
from String "XXXXXXX": not a valid
int
value "status": "{{#if (equals request.body 'hello')}}200{{else}}404{/if}}", "body": "{{#if (equals response.status 200)}}hello is present{{else}}hello is not present{/if}}"
b
Wouldn't creating two separate responders be an option? One for the 'if' case, another for the 'else' case? Keep it simple 🙂
m
It is. My bad I was thinking too complex. I'm from Infrastructure side and my new role gave me a chance to work on development side. Seems like my mind doesn't look for simple logical options instead tries to figure out why a this logic doesn't work and how to fix it. 😞 . Thank you for pointing it.
b
No worries, that’s what we’re here for!
m
Thank you.