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

Đang mở
#10,765 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@effect-bot đang làm issue này rồi.

Từ ngày 19/11/2026.

  • #10768 của @effect-bot — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
16.7k
Fork
808
Merge trung bình
20 giờ 31 phút
Pull request đã merge (30 ngày)
733

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Effect-TS/effect

Tất cả issue của Effect-TS/effect

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.