Skip to content

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

Open
@Kurichi

Description

@Kurichi

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"))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions