Add support redirect in http.server.handler() function for before_dispatch
Open
Nobody has claimed this yet.
feature
- Dominant language
- Lua
- Stars
- 81
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Hello. Can you add support return response from befor_dispatch function? It may usefull for handle bearing token auth or basic auth. I think you can change code like this:
local function handler(self, request)
if self.hooks.before_dispatch ~= nil then
- self.hooks.before_dispatch(self, request)
+ local resp = self.hooks.before_dispatch(self, request)
+
+ if resp then
+ return resp
+ end
end
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
Start at the http.server.handler() entry point and inspect how the before_dispatch hook is currently called. Update the hook handling so a returned response is used for early handling, and verify that normal dispatch still occurs when the hook returns nothing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100