Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Issue 11338054: Add an HTTP library that wraps dart:io. (Closed)

Created:
8 years, 1 month ago by nweiz
Modified:
8 years, 1 month ago
Reviewers:
Bob Nystrom
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add an HTTP library that wraps dart:io. Committed: https://code.google.com/p/dart/source/detail?r=14496

Patch Set 1 #

Total comments: 78

Patch Set 2 : Code review changes #

Total comments: 2

Patch Set 3 : Code review change #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1833 lines, -0 lines) Patch
A pkg/http/lib/http.dart View 1 1 chunk +174 lines, -0 lines 0 comments Download
A pkg/http/lib/src/base_client.dart View 1 1 chunk +135 lines, -0 lines 0 comments Download
A pkg/http/lib/src/base_request.dart View 1 1 chunk +117 lines, -0 lines 0 comments Download
A pkg/http/lib/src/base_response.dart View 1 1 chunk +44 lines, -0 lines 0 comments Download
A pkg/http/lib/src/client.dart View 1 1 chunk +82 lines, -0 lines 0 comments Download
A pkg/http/lib/src/request.dart View 1 2 1 chunk +162 lines, -0 lines 0 comments Download
A pkg/http/lib/src/response.dart View 1 1 chunk +87 lines, -0 lines 0 comments Download
A pkg/http/lib/src/streamed_request.dart View 1 1 chunk +49 lines, -0 lines 0 comments Download
A pkg/http/lib/src/streamed_response.dart View 1 1 chunk +33 lines, -0 lines 0 comments Download
A pkg/http/lib/src/utils.dart View 1 2 1 chunk +146 lines, -0 lines 0 comments Download
A pkg/http/pubspec.yaml View 1 chunk +5 lines, -0 lines 0 comments Download
A pkg/http/test/client_test.dart View 1 1 chunk +43 lines, -0 lines 0 comments Download
A pkg/http/test/http_test.dart View 1 1 chunk +185 lines, -0 lines 0 comments Download
A pkg/http/test/request_test.dart View 1 1 chunk +342 lines, -0 lines 0 comments Download
A pkg/http/test/response_test.dart View 1 1 chunk +68 lines, -0 lines 0 comments Download
A pkg/http/test/streamed_request_test.dart View 1 1 chunk +21 lines, -0 lines 0 comments Download
A pkg/http/test/utils.dart View 1 1 chunk +139 lines, -0 lines 0 comments Download
M pkg/pkg.status View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
nweiz
8 years, 1 month ago (2012-10-30 23:50:57 UTC) #1
Bob Nystrom
Lots of comments, but overall I really really like this. Can't wait to start using ...
8 years, 1 month ago (2012-10-31 01:17:44 UTC) #2
nweiz
https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart File pkg/http/lib/http.dart (right): https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart#newcode12 pkg/http/lib/http.dart:12: /// var uri = new Uri.fromString("http://example.com/whatsit/create"); On 2012/10/31 01:17:44, ...
8 years, 1 month ago (2012-10-31 18:20:58 UTC) #3
Bob Nystrom
Couple more suggestions/questions but almost there. https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart File pkg/http/lib/http.dart (right): https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart#newcode12 pkg/http/lib/http.dart:12: /// var uri ...
8 years, 1 month ago (2012-11-01 19:53:59 UTC) #4
nweiz
https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart File pkg/http/lib/http.dart (right): https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart#newcode12 pkg/http/lib/http.dart:12: /// var uri = new Uri.fromString("http://example.com/whatsit/create"); On 2012/11/01 19:53:59, ...
8 years, 1 month ago (2012-11-02 19:29:12 UTC) #5
Bob Nystrom
8 years, 1 month ago (2012-11-02 19:35:03 UTC) #6
LGTM!

https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart
File pkg/http/lib/http.dart (right):

https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/http.dart#newcode12
pkg/http/lib/http.dart:12: ///     var uri = new
Uri.fromString("http://example.com/whatsit/create");
On 2012/11/02 19:29:12, nweiz wrote:
> On 2012/11/01 19:53:59, Bob Nystrom wrote:
> > On 2012/10/31 18:20:59, nweiz wrote:
> > > On 2012/10/31 01:17:44, Bob Nystrom wrote:
> > > > This makes me wonder if the top-level functions should accept strings
for
> > the
> > > > first argument too.
> > > 
> > > That makes the type signature pretty ugly, but I guess it's probably worth
> it
> > > for usability. What are your thoughts on adding a "Url" or "StringOrUri"
> > typedef
> > > for better documentation?
> > 
> > I don't think we can use typedefs for this, at least not yet. As far as I
> know,
> > typedef is still just for function types right now. I guess we should
probably
> > just leave it typed and then document that it can take a URI or a string.
> 
> By "leave it typed" do you mean "leave it untyped"?

Yup, sorry.

https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/src/base_client....
File pkg/http/lib/src/base_client.dart (right):

https://codereview.chromium.org/11338054/diff/1/pkg/http/lib/src/base_client....
pkg/http/lib/src/base_client.dart:123: throw new HttpException("$message.");
On 2012/11/02 19:29:12, nweiz wrote:
> On 2012/11/01 19:53:59, Bob Nystrom wrote:
> > Yeah, I definitely wouldn't want to mix and match error types. But could we
> > consistently return a single HTTP error type that has useful fields?
> > 
> > I made this change in pub's io.dart because there is code in pub that looks
at
> > the status code to give a better error message. It's nice to have the
> exception
> > object expose that directly.
> 
> The thing is, most HTTP errors happen because of things like the response
> failing to parse or some formatting error in the request. In most cases it
> doesn't make sense to add extra metadata. Really the only case where it would
is
> for these convenience methods, and that raises the issues I described above.

SGTM.

Powered by Google App Engine
This is Rietveld 408576698