fasthttp / router

Router implementation for fasthttp
BSD 3-Clause "New" or "Revised" License
463 stars 47 forks source link

how to support path with and without trailing slash ? #69

Open peczenyj opened 1 year ago

peczenyj commented 1 year ago

I have a very restrictive requirement

I need to support path likes

/foo /foo/

without redirect from one form to the other ( in other words, the last trailing slash should be ignored )

https://github.com/buaazp/fasthttprouter works fine for this, but fasthttp/router panics

panic: a handler is already registered for path '/stream/'

goroutine 1 [running]:
github.com/fasthttp/router/radix.(*Tree).Add(0xc0003ee640, {0xc000120540, 0x8}, 0xc0003ed110)

how can I achieve it?

peczenyj commented 6 months ago

@savsgio any idea?

savsgio commented 5 months ago

Hi @peczenyj,

Sorry for my delayed answer.

Now the lib can't support this. But if you want and need it, I will be happy to review a PR 😉

peczenyj commented 5 months ago

Hi @peczenyj,

Sorry for my delayed answer.

Now the lib can't support this. But if you want and need it, I will be happy to review a PR 😉

I tried to add such feature but... it did not work properly. The impact is huge :/

I will keep trying, thanks