katt
katt copied to clipboard
Storing key value will always succeed even if key does not exists.
GET http://httpbin.org/cache
> User-Agent: KATT
< 200
< Content-Type: application/json
{
"foo": "{{>bar}}"
}
The key foo
does not exist so I would have assumed this would fail. It does not and bar
will get the value undefined
So is this an expected behaviour or a bug?
I would say it's expected. But i can also see how you may want to check for existence AND store value.
The primary reason why i say it's expected is the "AND" above i.e. KATT does one thing today, store the value, not two things.
If it is expected then it would be hard to change as it would break existing tests :-)
It is relative easy to work around: repeat the test - first run check the existence of the value and next time around store it.
Maybe a heads up in the documentation could be helpful? And a new feature {{>>bar}}
that will do both? :-)