Version: latest (0.12.2 atm)
Reproduction:
@Controller()
export class MyController {
@Post("")
@ControllerMethodArgs("body")
listen(
body: any
) {
console.log("received", body);
return "to be implemented";
}
}
Expectation: the snippet above results in the index route (/) being handled
Actual:
* Connected to localhost (127.0.0.1) port 1993
> POST / HTTP/1.1
> Host: localhost:1993
> User-Agent: curl/8.5.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 13
>
< HTTP/1.1 404 Not Found
< content-length: 0
< date: Wed, 11 Dec 2024 01:52:13 GMT
<
* Connection #0 to host localhost left intact
Notes: even this seems to be an unconventional (undocumented) usage (ie setting an empty string "" as the path, instead of a slash /), it's better to choose between:
- throwing an error or visible warning
- just defaulting empty string to
/ (and treating it as the index route by default)
Either approach above is better than silently failing / not handling the route like currently.