forked from dart-lang/shelf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
MiddlewareExtensions
which provides addMiddleware
and `addH…
…andler` (dart-lang#196) ...to `Middleware` instances. Provides easier access to the composition capabilities offered by `Pipeline`.
- Loading branch information
Showing
6 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'handler.dart'; | ||
import 'middleware.dart'; | ||
|
||
/// Extensions on [Middleware] to aid in composing [Middleware] and [Handlers]. | ||
/// | ||
/// These members can be used in place of [Pipeline]. | ||
extension MiddlewareExtensions on Middleware { | ||
/// Merges `this` and [other] into a new [Middleware]. | ||
Middleware addMiddleware(Middleware other) => | ||
(Handler handler) => this(other(handler)); | ||
|
||
/// Merges `this` and [handler] into a new [Handler]. | ||
Handler addHandler(Handler handler) => this(handler); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters