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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/command/uploader.dart

Issue 65583004: Add utility methods for sending non-form data in pkg/http. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/oauth2/lib/src/credentials.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub.command.uploader; 5 library pub.command.uploader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (package != null) return package; 62 if (package != null) return package;
63 return new Entrypoint(path.current, cache).root.name; 63 return new Entrypoint(path.current, cache).root.name;
64 }).then((package) { 64 }).then((package) {
65 var uploader = rest[0]; 65 var uploader = rest[0];
66 return oauth2.withClient(cache, (client) { 66 return oauth2.withClient(cache, (client) {
67 if (command == 'add') { 67 if (command == 'add') {
68 var url = server.resolve("/api/packages/" 68 var url = server.resolve("/api/packages/"
69 "${Uri.encodeComponent(package)}/uploaders"); 69 "${Uri.encodeComponent(package)}/uploaders");
70 return client.post(url, 70 return client.post(url,
71 headers: PUB_API_HEADERS, 71 headers: PUB_API_HEADERS,
72 fields: {"email": uploader}); 72 body: {"email": uploader});
73 } else { // command == 'remove' 73 } else { // command == 'remove'
74 var url = server.resolve("/api/packages/" 74 var url = server.resolve("/api/packages/"
75 "${Uri.encodeComponent(package)}/uploaders/" 75 "${Uri.encodeComponent(package)}/uploaders/"
76 "${Uri.encodeComponent(uploader)}"); 76 "${Uri.encodeComponent(uploader)}");
77 return client.delete(url, headers: PUB_API_HEADERS); 77 return client.delete(url, headers: PUB_API_HEADERS);
78 } 78 }
79 }); 79 });
80 }).then(handleJsonSuccess) 80 }).then(handleJsonSuccess)
81 .catchError((error) => handleJsonError(error.response), 81 .catchError((error) => handleJsonError(error.response),
82 test: (e) => e is PubHttpException); 82 test: (e) => e is PubHttpException);
83 } 83 }
84 } 84 }
OLDNEW
« no previous file with comments | « pkg/oauth2/lib/src/credentials.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698