Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Task middleware just show based on app and child apps #1379

Closed
sio4 opened this issue Oct 16, 2018 · 1 comment
Closed

Task middleware just show based on app and child apps #1379

sio4 opened this issue Oct 16, 2018 · 1 comment

Comments

@sio4
Copy link
Member

sio4 commented Oct 16, 2018

Hi, @markbates and all

Description

I didn't notice yet but today, I found buffalo task middleware just shows middleware stack for App and its children, registered with App.Group(). (also it shows Resources since it registered with Group() internally.)

But I guess most of the buffalo lovers usually use Skip() for some handlers, and the command does not show about it. If it shows full middleware stacks with skipped handlers, It should be helpful for us.

So I tried to improve it on the my copy of master branch. Can I open a PR for this against development branch some hours later after sleep and some more check? Please read the details below.

Steps to Reproduce the Problem, and Actual Behavior

So for my current development, the command shows me something like below:

$ buffalo t middleware
-> /
<...>
github.com/gobuffalo/mw-i18n.*Translator.Middleware.func1
github.com/hyeoncheon/skel/actions.AuthorizeHandler
-> /auth
<...>
github.com/gobuffalo/mw-i18n.*Translator.Middleware.func1
-> /users
<...>
github.com/gobuffalo/mw-i18n.*Translator.Middleware.func1
github.com/hyeoncheon/skel/actions.AuthorizeHandler
$

(I just suppress some default middlewares with <...> for more easy reading.)

There is two unhappy things:

  • even though /users, registered with Resource(), has same middleware stack, it is shown again.
  • I exclude GET / with Skip() but it is not shown and I cannot check its status.

Expected Behavior

So I tried to improve it and get the following result:

$ buffalo t middleware
-> /
<...>
github.com/gobuffalo/mw-i18n.*Translator.Middleware.func1
github.com/hyeoncheon/skel/actions.AuthorizeHandler
-> / (GET handler:github.com/hyeoncheon/skel/actions.HomeHandler)
<...>
github.com/gobuffalo/mw-i18n.*Translator.Middleware.func1
-> /auth
<...>
github.com/gobuffalo/mw-i18n.*Translator.Middleware.func1
$ 

As shown above, it does not show the same stack again for Resource if it has the same stack, and it shows actual, applied middleware stack for handers registered for skipping.

How about this?

@sio4
Copy link
Member Author

sio4 commented Oct 18, 2018

Closed by #1380.

@sio4 sio4 closed this as completed Oct 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant