Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing key value will always succeed even if key does not exists. #69

Open
mekanixdk opened this issue Jul 3, 2018 · 2 comments
Open

Comments

@mekanixdk
Copy link

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?

@andreineculau
Copy link
Member

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.

@mekanixdk
Copy link
Author

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? :-)

@andreineculau andreineculau added this to the 1.7.0 milestone May 19, 2019
@andreineculau andreineculau removed this from the 1.7.0 milestone Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants