Add new hook middleware names: new.user, new.session, and on.request


#1

@AlexSwe Are you open to adding more middleware names?

I wish there were additional middlewares in addition to: before.handler, handler, and after.handler

Here is the order of when middleware and handlers are currently called:

HOOK - before.handler
NEW_USER
NEW_SESSION
ON_REQUEST
LAUNCH
HOOK - handler
HOOK - after.handler

Here is my proposal with additional middlewares: new.user, new.session, and on.request each with a before and after option:

HOOK - before.handler
HOOK - before.new.user
NEW_USER
HOOK - new.user
HOOK - after.new.user
HOOK - before.new.session
NEW_SESSION
HOOK - new.session
HOOK - after.new.session
HOOK - before.on.request
ON_REQUEST
HOOK - on.request
HOOK - after.on.request
LAUNCH
HOOK - handler
HOOK - after.handler

My scenario is that for a launch, I want to use the initial values set in NEW_USER but plug into HOOK:new.user so I can modify some values. This is helping me with unit testing as the hook is only added during unit testing.

I can see these additional hook middlewares being useful to others.

Thanks,

Mark


#2

Hey @marktucker!
This is a great suggestion, we’re actually working on it. It’s even on my today’s tasklist :slight_smile:

Unfortunately, it’s not a quick fix with the current code architecture. It’ll be one of many features of v3.0 :smiley: