openresty / openresty/lua-nginx-module
Appending keys to ngx.req and ngx.resp
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
Is it a bad idea to append new keys to ngx.req/resp? For example, would the following be considered bad?
if ngx.var.request_method == 'POST' then
ngx.req.read_body()
ngx.req.rawBody = ngx.req.get_body_data()
if ngx.headers['content-type'] == 'application/json' then
local ok, payload = pcall(cjson.decode, ngx.req.get_body_data())
if ok then
ngx.req.body = payload
end
end
end
So that I can automatically parse the post body in the instantiation of my app, and then just pass around ngx.req and ngx.resp to all my controllers?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is identified; begin with the ngx.req and ngx.resp API entry points named in the issue. A complete outcome would need a maintainer decision on whether these extensions are supported and a specified code or documentation target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100