tus / tusd

Reference server implementation in Go of tus: the open protocol for resumable file uploads
https://tus.github.io/tusd
MIT License
3.05k stars 475 forks source link

Will There Be a NewUnroutedHandlerWithHooks? #1005

Closed jimydavis closed 1 year ago

jimydavis commented 1 year ago

There is a NewHandlerWithHooks in v2. Will there be a NewUnroutedHandlerWithHooks ? From looking at the code, it seems like if I start copy pasting the language inside NewHandlerWithHooks, I will end up forking the whole repo.

Thank you!

Acconut commented 1 year ago

You can access the unrouted handler from a routed handler through the embedded struct. So maybe you can do the following:

routedHandler := hooks.NewHandlerWithHooks(...)
unroutedHandler := routedHandler.UnroutedHandler

I haven't tried it yet, but if this works, we can add this as an implementation for NewUnroutedHandlerWithHooks

jimydavis commented 1 year ago

@Acconut I have tried and it works. Thanks for the amazingly fast reply.