Skip to content

Allow escaped : char in route path #1987

Closed
@aldas

Description

@aldas

Discussed in #1986

Originally posted by morilog September 16, 2021
Can I able to escape : char in route path to achieve compatiblity with google API design custom methods? something like fiber framework

For example in https://service.name/v1/some/resource/name:customVerb, 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 {
		resp := fmt.Sprintf("mehtod: %v\n", c.Request().Method)
		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