From 85a14f2b5cecb199b856264df1b2e2de6b4cd9da Mon Sep 17 00:00:00 2001 From: David Ortiz Date: Mon, 23 Apr 2018 10:56:17 +0200 Subject: [PATCH] policy/local_chain: return the chain in build_chain() Makes the code a bit more readable. --- gateway/src/apicast/policy/local_chain/local_chain.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gateway/src/apicast/policy/local_chain/local_chain.lua b/gateway/src/apicast/policy/local_chain/local_chain.lua index b306e10d9..757739d59 100644 --- a/gateway/src/apicast/policy/local_chain/local_chain.lua +++ b/gateway/src/apicast/policy/local_chain/local_chain.lua @@ -28,7 +28,11 @@ local function build_chain(context) local proxy = Proxy.new(context.configuration) context.proxy = context.proxy or proxy - context.policy_chain = find_policy_chain(context) + + local policy_chain = find_policy_chain(context) + context.policy_chain = policy_chain + + return policy_chain end -- forward all policy methods to the policy chain @@ -45,9 +49,9 @@ end local rewrite = _M.rewrite function _M:rewrite(context, ...) - build_chain(context) + local policy_chain = build_chain(context) - context = LinkedList.readwrite(context, find_policy_chain(context):export()) + context = LinkedList.readwrite(context, policy_chain:export()) rewrite(self, context, ...) end