Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/ghttp: How about adding SetUri and RestartRouting feature? #4080

Open
canbusio opened this issue Dec 25, 2024 · 3 comments
Open

net/ghttp: How about adding SetUri and RestartRouting feature? #4080

canbusio opened this issue Dec 25, 2024 · 3 comments
Labels
discuss We need discuss to make decision. feature help wanted inactive

Comments

@canbusio
Copy link

canbusio commented Dec 25, 2024

Is your feature request related to a problem?

No and Yes.

Describe the solution you'd like

Sth. like c.Path("/new_uri") and c.RestartRouting() in gofiber v3.

https://docs.gofiber.io/next/api/ctx#restartrouting

Describe alternatives you've considered

Or sth. like rewrite ... last in nginx.

Additional

No response

@gqcn
Copy link
Member

gqcn commented Dec 26, 2024

@canbusio Internal redirecting by URI is a lower priority feature that not much necessary for most golang servers, but we can also consider it. We can add these implements:

  • add InternalRouting() InternalRouting for ghttp.Request for internal routing features.
  • add InternalRouting.CallRouteFunc(uri string) directly call route function by URI in current handler.
  • add InternalRouting.Redirect(uri string) redirect the request flow to another route and end current flow.

We can discuss this feature here, and it can be implemented by anyone that is interested in this.

@gqcn gqcn added the discuss We need discuss to make decision. label Dec 26, 2024
@canbusio
Copy link
Author

add InternalRouting.CallRouteFunc(uri string) directly call route function by URI in current handler.

This one is what I need.

Internal redirecting by URI is a lower priority feature that not much necessary for most golang servers.

I agree with that.Very few people would need this feature.
I don't use RestartRouting() in gofiber, because it's better to call handler() directly.
But I need this feature in goframe when using group.Bind().

Copy link

Hello @canbusio. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it!
你好 @canbusio。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss We need discuss to make decision. feature help wanted inactive
Projects
None yet
Development

No branches or pull requests

2 participants