WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Support Escaping Colons in Routes to Allow Google-Style Custom Methods #4562

@Marley-Mulvin-Broome

Description

@Marley-Mulvin-Broome

What is the feature you are proposing?

Description

Some APIs follow the Google AIP convention for custom methods, where actions on a resource are expressed with a colon suffix instead of an additional sub-path. Examples include:

/books/69420:archive - performs the archive action on book 69420

/books:create - performs a collection-level create action

In Hono, the colon currently indicates the start of a path parameter, which makes it difficult to define these routes without workarounds (see #1301). It would be useful to provide a clean, explicit way to escape a colon so that it is interpreted as a literal character rather than the start of a parameter.

Examples of proposed syntax:

/books/:id\:archive

/books\:create

Requested Enhancement:

Add a mechanism to escape colons in route definitions so that Hono can cleanly support Google AIP-style custom methods without interfering with parameter parsing.

This would allow developers to register routes that match these patterns directly and maintain compatibility with APIs that adopt this style.

Use Cases:

Implementing Google-style custom methods.

Integrating with APIs or microservices already using these conventions.

Generating client libraries that depend on predictable literal route shapes.

Expected Outcome:

A consistent, documented way to escape colons in route paths so that Hono treats them as literal characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions