hanqingwu commented on issue #12532:
URL: https://github.com/apache/apisix/issues/12532#issuecomment-3205527926

   Since table in Lua is a reference type and new_messages and conf.prepend 
point to the same table, any modification to new_messages will directly affect 
the original value of conf.prepend.
   
   I fix the code like this,  it works file.
   @hw872715125  can you try this ?
   
   ` local function decorate(conf, body_tab)
   -    local new_messages = conf.prepend or EMPTY
   +    local new_messages = {}
   +    if conf.prepend then
   +        for i = 1, #conf.prepend do
   +            new_messages[i] = conf.prepend[i]
   +        end
   +    end
   +
        for _, message in pairs(body_tab.messages) do
            core.table.insert_tail(new_messages, message)
        end
   `
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to