Skip to content
Open
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
9 changes: 7 additions & 2 deletions docs/en/latest/plugins/serverless.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ Only Lua functions are allowed here and not other Lua code.
For example, anonymous functions are legal:

```lua
return function()
ngx.log(ngx.ERR, 'one')
return function(conf, ctx)
local core = require("apisix.core")
Comment on lines +50 to +51
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description/issue #8980 asks to update the serverless plugin documentation example shown under "Enable Plugin" to demonstrate URI argument manipulation, but this change only updates the earlier "anonymous functions are legal" snippet. Consider updating the "Enable Plugin" JSON example (and the later log-output text) to use this new, more meaningful function so the documentation matches the stated goal.

Copilot uses AI. Check for mistakes.
if not ngx.var.arg_name then
local uri_args = core.request.get_uri_args(ctx)
Comment on lines +52 to +53
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example checks ngx.var.arg_name (which corresponds to the name query parameter) but later sets uri_args.name. This mismatch is likely to confuse readers; consider either checking uri_args.name after calling core.request.get_uri_args(ctx) or renaming/adjusting the example so the checked key and the assigned key clearly match.

Suggested change
if not ngx.var.arg_name then
local uri_args = core.request.get_uri_args(ctx)
local uri_args = core.request.get_uri_args(ctx)
if not uri_args.name then

Copilot uses AI. Check for mistakes.
uri_args.name = "world"
ngx.req.set_uri_args(uri_args)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use core.request.set_uri_args

end
end
```

Expand Down
Loading