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

Allow escaped : char in route path after route parameter #2756

Open
Kurichi opened this issue Mar 16, 2025 · 0 comments
Open

Allow escaped : char in route path after route parameter #2756

Kurichi opened this issue Mar 16, 2025 · 0 comments

Comments

@Kurichi
Copy link

Kurichi commented Mar 16, 2025

Regarding the google API design custom methods, the issue has been resolved in PR #1988.

However, this solution is not complete as it does not allow a custom method to be appended after a path parameter.

For example in https://service.name/v1/some/resource/{name}:customVerb, the {name} is route parameter, the :customVerb is not route parameter and only is a simple string.

// curl -v -X POST "http://localhost:8088/v1/some/resource/name:undelete"
func main() {
	e := echo.New()

	// route path as Cloud API "custom method"
	// https://cloud.google.com/apis/design/custom_methods
	e.POST("/v1/some/resource/:name\\:undelete", func(c echo.Context) error {
		name := c.Param("name")
		resp := fmt.Sprintf("%s undeleted", name)
		return c.String(200, resp)
	})
	log.Fatal(e.Start(":8088"))
}
@Kurichi Kurichi changed the title Allow escaped : char in route path after path-param Allow escaped : char in route path after route parameter Mar 16, 2025
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