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

Extend the routing tree entry #3913

Open
Yjppj opened this issue Apr 1, 2024 · 0 comments
Open

Extend the routing tree entry #3913

Yjppj opened this issue Apr 1, 2024 · 0 comments

Comments

@Yjppj
Copy link

Yjppj commented Apr 1, 2024

  • With issues:
    • Use the search tool before opening a new issue.
    • Please provide source code and commit sha if you found a bug.
    • Review existing issues and provide feedback or react to them.

Description

I want to use the prefix tree of Gin now. I hope to register a DINGEVENT method and build a prefix tree for this method at the same time. This step is no problem, and the following code can be used:

type MyRouterGroup struct {
	RouterGroup *gin.RouterGroup
}

func (group *MyRouterGroup) DingEvent(event_url string, handlerFunc gin.HandlerFunc) {
	group.RouterGroup.Handle("DINGEVENT", event_url, handlerFunc)
}

However, I have no way to enter this routing tree (unless I modify the Gin source code), because only when an HTTP request is sent, will it be matched in the routing tree.

Is there a custom method that allows me to match the routing tree like processing HTTP requests?

Environment

  • go version: 1.21
  • gin version (or commit ref): 1.8
  • operating system: Mac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant