APIcast
APIcast copied to clipboard
Some liquid functions are not working - especially the time functions
All of the time functions are returning the empty string:
Functions: time
, today
, http_time
, cookie_time
, localtime
, now
, utctime
Version
3scale 2.3-CR1
Steps To Reproduce
- Create application
- add URL rewrite policy
- add rules for any of these functions with liquid
Example:
arg
={{ now }}
- Make a request and response should look like:
"args": "user_key=5941428bd561fa5a91489f2c36ed8cb3&arg=",
Current Result
{
"method": "GET",
"path": "/test/path",
"args": "user_key=5941428bd561fa5a91489f2c36ed8cb3&arg=",
"body": "",
...
}
Expected Result
{
"method": "GET",
"path": "/test/path",
"args": "user_key=5941428bd561fa5a91489f2c36ed8cb3&arg=TIMESTAMP",
"body": "",
...
}
Here is the issue in JIRA: https://issues.jboss.org/browse/THREESCALE-1329
WORKAROUND
Currently, how these functions work - it is required to call it this way: {{ <some_param> | now}}
So, for example, this works: {{ uri | now }}
Hi @pestanko ,
This happens because we expose all the functions that you mention (now
, utctime
) as "liquid filters". Liquid filters are called like this: {{ arg | filter }}
: https://help.shopify.com/en/themes/liquid/filters
The problem is that we shouldn't have exposed functions that do not receive any params as filters, because then, in order to call them something like {{ '' | filter }}
is needed. We should expose these kind of functions as parameters, not as filters.