Vapor: 4.54.0 Release

Release date:
December 6, 2021
Previous version:
4.53.0 (released November 21, 2021)
Magnitude:
90 Diff Delta
Contributors:
1 total committer
Data confidence:
Commits:

Top Contributors in 4.54.0

NeedleInAJayStack

Directory Browser for 4.54.0

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

This patch was authored by @NeedleInAJayStack and released by @0xTim.

<!-- πŸš€ Thank you for contributing! -->

<!-- Describe your changes clearly and use examples if possible. -->

Many HTTP servers support specifying a default file when a request hits a public directory. For example, a request to http://server.com/path/ may automatically serve the file at path/index.html.

This PR adds this functionality to the FileMiddleware via an initialization parameter. It defaults to disabled but can be customized to whatever default file name is desired. This default file name is also served automatically for all subdirectory queries. If the default file does not exist, the request is passed on to the next Responder.

A usage example:

// Default file serving is disabled
app.middleware.use(FileMiddleware(publicDirectory: "public/"))

// Serves `index.html` (if it exists) to a request to `http://server.com/`, as well as any subdirectories
app.middleware.use(FileMiddleware(publicDirectory: "public/", defaultFile: "index.html"))

Resolves: https://github.com/vapor/vapor/issues/2455

<!-- When this PR is merged, the title and body will be --> <!-- used to generate a release automatically. -->