HttpApiEndpoint: static path and wildcard (/*) path with the same prefix are treated as duplicate routes

未关闭
#10,765 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@effect-bot 已经在做这个了。

开始于 2026年11月19日。

  • #10768 来自 @effect-bot —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

bug
What version of Effect is running?

4.1.4

What steps can reproduce the bug?

Declare two GET endpoints in the same group, one with a static path and one with a wildcard under the same prefix:

import { HttpApi, HttpApiEndpoint, HttpApiGroup } from "effect/httpapi"

const Group = HttpApiGroup.make("test").add(
  HttpApiEndpoint.get("test-static", "/test"),
  HttpApiEndpoint.get("test-wildcard", "/test/*")
)

const Api = HttpApi.make("api").add(Group)

Then build and serve the API (e.g. via HttpApiBuilder.layer(Api) with handlers for both endpoints). The failure appears at runtime when the routes are registered.

What is the expected behavior?

Both endpoints register successfully. /test and /test/* are different route patterns, and many routers treat them as distinct:

  • GET /test → test-static
  • GET /test/anything → test-wildcard
What do you see instead?
error: Method 'GET' already declared for route '/test'
Additional information
  • The two endpoints have different names and different path patterns, so this doesn't look like a genuine duplicate declaration.
  • It looks like the router treats /test/* as also matching /test (or normalizes the wildcard away), so the second registration collides with the first.
  • If that is intended behavior, it would help to have it documented, and ideally to have a supported way to register both a static route and a wildcard route under the same prefix.
主要语言
TypeScript
星标
16.7k
派生
808
平均合并
20 小时 31 分钟
30 天内合并 PR
733

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Effect-TS/effect 的其他 Issue

查看 Effect-TS/effect 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。