-
Notifications
You must be signed in to change notification settings - Fork 382
Fix http.testing doc example #37
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,15 @@ | |
/// import 'dart:convert'; | ||
/// import 'package:http/testing.dart'; | ||
/// | ||
/// var client = new MockClient((request) { | ||
/// var client = new MockClient((request) async { | ||
/// if (request.url.path != "/data.json") { | ||
/// return new Response("", 404); | ||
/// } | ||
/// return new Response(JSON.encode({ | ||
/// 'numbers': [1, 4, 15, 19, 214] | ||
/// }, 200, headers: { | ||
/// 'content-type': 'application/json' | ||
/// }); | ||
/// }; | ||
/// return new Response( | ||
/// JSON.encode({ | ||
/// 'numbers': [1, 4, 15, 19, 214] | ||
/// }), | ||
/// 200, | ||
/// headers: {'content-type': 'application/json'}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this new formatting reads less well than the original, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For what it's worth, I actually like the new output. I think the 200 gets a little lost in the before code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So ... is this ready to be merged? (IMHO, the raison d'etre of source code formatters is that they relieve us, as designers, from the tedium and trivialities surrounding code layout :) |
||
/// }); | ||
export 'src/mock_client.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.
I don't think it needs to be
async
, but @nex3 would know better.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.
It doesn't type check otherwise. The expected type of the constructor argument is