Skip to content

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

Open
@norguhtar

Description

@norguhtar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions