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

Aperta
#10,765 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@effect-bot ci sta già lavorando.

Dal 19/11/2026.

  • #10768 di @effect-bot — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.
Lingua principale
TypeScript
Stelle
16.7k
Fork
808
Merge medio
20h 31m
PR unite (30g)
733

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Effect-TS/effect

Tutte le issue di Effect-TS/effect

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.