/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-include-slashes-671dcb453d6b-include-slashes-s0055-c0000.md
Include slashes - hono-docs
Include slashes Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt include slashes Summary hc functi...
Include slashes
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#include-slashes
Summary
hc function does not URL-encode the values of param. To include slashes in parameters, use regular expressions. ```ts // client.ts // Requests /posts/123/456 const res = await client.posts[':id'].$get({ pa...
Content
hc function does not URL-encode the values of param. To include slashes in parameters, use regular expressions.
// client.ts
// Requests /posts/123/456
const res = await client.posts[':id'].$get({
param: {
id: '123/456',
},
})
// server.ts
const route = app.get(
'/posts/:id{.+}',
zValidator(
'param',
z.object({
id: z.string(),
})
),
(c) => {
// id: 123/456
const { id } = c.req.valid('param')
// ...
}
)[!NOTE] Basic path parameters without regular expressions do not match slashes. If you pass a
paramcontaining slashes using the hc function, the server might not route as intended. Encoding the parameters usingencodeURIComponentis the recommended approach to ensure correct routing.