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

Some liquid functions are not working - especially the time functions #909

Open
pestanko opened this issue Sep 24, 2018 · 2 comments
Open

Comments

@pestanko
Copy link

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
  1. Create application
  2. add URL rewrite policy
  3. add rules for any of these functions with liquid
    Example: arg = {{ now }}
  4. 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": "",
...
}
@pestanko
Copy link
Author

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 }}

@davidor
Copy link
Contributor

davidor commented Sep 25, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants