hummingbird-project / hummingbird

Lightweight, flexible HTTP server framework written in Swift
https://hummingbird.codes/
Apache License 2.0
1.23k stars 54 forks source link

FileMiddleware and 404 responses #592

Open adam-fowler opened 1 month ago

adam-fowler commented 1 month ago

Currently the FileMiddleware runs whenever the router throws a 404 HTTPError. It does not run if a Response is returned whose status is 404.

Should we consider a returned 404 responses as a reason to kick off the FileMiddleware? On one hand a returned response could be considered as already handled and therefore we shouldn't kick off the FileMiddleware. On the other people have been caught out by this.

Options:

@tib

Joannis commented 1 month ago

Oh, interesting question! I'd vote for an option here, but think that this type of option is inherently so undiscoverable I don't think it'll be used in practice.

tib commented 1 month ago

I would also like to have on the option to pick the desired behavior, plus improved documentation of course. :)