hossein1376 / grape

Modern, zero-dependency HTTP library for Go
https://pkg.go.dev/github.com/hossein1376/grape
MIT License
149 stars 5 forks source link

not found and method not allowed #7

Open mybigman opened 2 weeks ago

mybigman commented 2 weeks ago

can you add the ability to set these?

hossein1376 commented 2 weeks ago

Hey! That is a feature I really liked to have as well. Unfortunately, these two are hard coded into the standard library.

Not Found: https://github.com/golang/go/blob/master/src/net/http/server.go#L2250

Not Allowed: https://github.com/golang/go/blob/master/src/net/http/server.go#L2625-L2627

Grape, being a wrapper around stdlib, has no ways to set them directly. I will try creating a PR to make these two dynamic. With any luck, we may have this feature in future Go releases. That's a long shot though.

mybigman commented 2 weeks ago

theres a few routers you might be able to get an idea from that do this.

https://github.com/yousuf64/shift https://github.com/uptrace/bunrouter https://github.com/razonyang/fastrouter https://github.com/nbari/violetear

hossein1376 commented 2 weeks ago

I appreciate your suggestion, although all of these packages are implementing the routing themselves. Grape, on the other hand, relies on the standard library for the routing. Hence, some features depend on the flexibility of stdlib's APIs.