Skip to content

Commit

Permalink
createStaticHandler: update Response.context documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpassos committed Dec 6, 2023
1 parent 688969f commit 9d22a81
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkgs/shelf_static/lib/src/static_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ final _defaultMimeTypeResolver = MimeTypeResolver();
/// detection.
///
/// The [Response.context] will be populated with "shelf_static:file" or
/// "shelf_static:file_not_found" with the resolved [File] for the [Response],
/// while respecting [serveFilesOutsidePath] to prevent exposing a [File] path
/// outside of the [fileSystemPath].
/// "shelf_static:file_not_found" with the resolved [File] for the [Response].
/// If the file is considered not found because it is outside of the
/// [fileSystemPath] and [serveFilesOutsidePath] is false, then neither key
/// will be included in the context.
Handler createStaticHandler(String fileSystemPath,
{bool serveFilesOutsidePath = false,
String? defaultDocument,
Expand Down Expand Up @@ -140,7 +141,7 @@ Handler createStaticHandler(String fileSystemPath,
Map<String, Object>? _buildResponseContext({File? file, File? fileNotFound}) {
if (file == null && fileNotFound == null) return null;

// Ensure other Shelf `Middleware` can identify
// Ensure other shelf `Middleware` can identify
// the processed file in the `Response` by
// including `file` and `file_not_found` in the context:
return {
Expand Down

0 comments on commit 9d22a81

Please sign in to comment.