Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/liquid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3039,6 +3039,7 @@ Liquid.Parser = Parser
Liquid.Interpreter = Interpreter
Liquid.InterpreterContext = InterpreterContext
Liquid.FilterSet = FilterSet
Liquid.ResourceLimit = ResourceLimit
Liquid.FileSystem = FileSystem
Liquid.ParserContext = ParserContext
Liquid.Lazy = Lazy
Expand Down
21 changes: 21 additions & 0 deletions t/interpreter.t
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,24 @@ GET /t

--- no_error_log
[error]


=== TEST 21: setting custom resource limit.
--- http_config eval: $::HttpConfig
--- config
location /t {
content_by_lua_block {
local Liquid = require 'liquid'
local document = "{% for i in (1..5) %}{{ i }}{% endfor %}"
local template = Liquid.Template:parse(document)
local limit = Liquid.ResourceLimit:new(0, 0, 3)
local ok, err = pcall(template.render, template, nil, nil, limit)
if not ok then ngx.say(err) end
}
}
--- request
GET /t
--- response_body_like
too many loopcount. limit num:3
--- no_error_log
[error]