BUG: data_dict variable is confused among different routing plugins

BUG: data_dict variable is confused among different routing plugins

kong version >=0.14.1

kong service: www.foo.com
kong route:
├ path: /mypath1 plugin: my-plugin( different config data)
├ path: /mypath2 plugin: my-plugin( different config data)

plugin code example:

local data_dict = {}
local plugin = require("kong.plugins.base_plugin"):extend()

function plugin:new()
    plugin.super.new(self, "myplugin")
end

function plugin:access(conf)
    plugin.super.access(self)

      
      --init conf.identify_values array to data_dict 
      --conf.identify_values : A=1 , B=2
      --data_dict                  :  {A=1,B=2}
      init_data(conf.identify_values)

      --print data
      dump(data_dict) 
      dump(conf.identify_values) 

      --print table address
      kong.log.err(tostring(data_dict)) 
      kong.log.err(tostring(conf.identify_values))

end

plugin.PRIORITY = 12

return plugin

Plugin config:
path: /mypath1 plugin: my-plugin( conf.identify_values : A=1 , B=2 )
path: /mypath2 plugin: my-plugin( conf.identify_values : C=3 , D=4)

The request for many times:

http://www.foo.com/mypath1
http://www.foo.com/mypath2

link:https://github.com/Kong/kong/issues/6119

@hbagdi
@thibaultcha


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ