Skip to content

.catchall Does Not Catch /Β #147

@Frizlab

Description

@Frizlab

Hello!
I tried catching all the requests in my server w/ a simple

app.get(.catchall, use: c.myHandler)

however it seems / is not caught.

Is this the expected behaviour?

Steps to reproduce

With this simple route

func routes(_ app: Application) throws {
	let c = MyAwesomeController()
	app.get(.catchall, use: c.myHandler)
}

Do curl localhost:8080

Expected behavior

My controller is called.

Actual behavior

It is not called and I get a 404 Not Found.
I have to add this in my routes.

app.get(use: c.myHandler)

Note that I don’t mind that! I juste want to be sure this is the expected behaviour (and maybe have a rationale if possible as to why if it is 😊).

Environment

  • Vapor Framework version: 4.0.0-rc.3.12
  • Vapor Toolbox version: 3.1.10
  • OS version: 10.15.4

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions