diff --git a/gateway/src/apicast/threescale_utils.lua b/gateway/src/apicast/threescale_utils.lua index 268d50870..22dedb772 100644 --- a/gateway/src/apicast/threescale_utils.lua +++ b/gateway/src/apicast/threescale_utils.lua @@ -124,7 +124,7 @@ function _M.connect_redis(options) local opts = {} local url = options and options.url or env.get('REDIS_URL') - local resilient = options.resilient or false + local resilient = options.resilient if url then url = resty_url.split(url, 'redis') @@ -194,7 +194,7 @@ function _M.error(resilient, ...) else ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR ngx.say(...) - if not resilient or resilient == nil then + if not resilient then ngx.exit(ngx.status) end end diff --git a/spec/threescale_utils_spec.lua b/spec/threescale_utils_spec.lua index be7c8bb40..ff64c2aa8 100644 --- a/spec/threescale_utils_spec.lua +++ b/spec/threescale_utils_spec.lua @@ -16,7 +16,7 @@ describe('3scale utils', function() stub(ngx, 'say', function(...) return nil end) local exit = spy.on(ngx, 'exit', function(s) return 'exited!' end) - local error = _M.error(false, 'cache issue ' .. 'host:' .. 6379) + local error = _M.error(nil, 'cache issue ' .. 'host:' .. 6379) assert.spy(ngx.exit).was_called(1) assert.spy(ngx.say).was.called_with('cache issue ' .. 'host:' .. 6379)