http icon indicating copy to clipboard operation
http copied to clipboard

Add support redirect in http.server.handler() function for before_dispatch

Open norguhtar opened this issue 6 years ago • 0 comments

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

norguhtar avatar Feb 20 '19 09:02 norguhtar