-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Pipeline implementation #87
Conversation
This is dependent on #85 Enabling tests is dependent on dart-archive/package_resolver#4 |
@nex3 trying to get some more parallelism. |
lib/src/pipeline.dart
Outdated
/// var client = const Pipeline() | ||
/// .addMiddleware(loggingMiddleware) | ||
/// .addMiddleware(basicAuthMiddleware) | ||
/// .addHandler(new Client()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addClient()
It may make sense to also add an addHandler()
method, though, which automatically creates a Client
.
lib/src/pipeline.dart
Outdated
/// .addHandler(new Client()); | ||
class Pipeline { | ||
final Pipeline _parent; | ||
final Middleware _middleware; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document these.
test/pipeline_test.dart
Outdated
|
||
import 'package:http/http.dart'; | ||
import 'package:test/test.dart'; | ||
// \TODO REMOVE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was doing the pull requests all in tandem so I didn't want to end up with a conflict with the exports. Will fix with a rebase.
test/pipeline_test.dart
Outdated
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:http/http.dart'; | ||
import 'package:test/test.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package:
imports for other packages should be separate from package:
imports for the current package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so from here on out you want the order to be
- Other package dependencies
- This package dependencies
- Relative imports
Wasn't the case with the previous test files but I can modify accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; see the style guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
test/pipeline_test.dart
Outdated
|
||
void main() { | ||
test('compose middleware with Pipeline', () async { | ||
int accessLocation = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't type-annotate local variables.
2a22671
to
c4351a0
Compare
test/pipeline_test.dart
Outdated
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:http/http.dart'; | ||
import 'package:test/test.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; see the style guide.
Adds the
Pipeline
class and associated tests.