-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the issue
A path component with a slash is accepted, but cannot be reached with HTTP requests
Vapor version
4.115.0
Operating system and version
macOS 15.5
Swift version
6.1.0
Steps to reproduce
// 404
app.get("te/st") { req -> HTTPStatus in
.noContent
}
$ curl -v http://127.0.0.1:8080/te/st
* Trying 127.0.0.1:8080...
* Connected to 127.0.0.1 (127.0.0.1) port 8080
> GET /te/st HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 404 Not Found
< content-type: application/json; charset=utf-8
< content-length: 35
< connection: keep-alive
< date: Tue, 15 Jul 2025 22:49:46 GMT
<
* Connection #0 to host 127.0.0.1 left intact
{"reason":"Not Found","error":true}%
Outcome
Should have gotten a 204 not a 404
Additional notes
It's not clear what a good solution would be. The initializer for PathComponent
would have to throw an error, or a static function would have to be created which returns an array all the time, and handles the splitting by slash itself.
Alternatively, RoutesBuilder.on(_:_:body:use:)
could scan for slashes and fail if any are found.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working