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

Side by Side Diff: recipes/dart_io/pkg_http/bin/adding_custom_headers.dart

Issue 99333012: The first few short pkg:http examples (Closed) Base URL: https://github.com/dart-lang/cookbook.git@master
Patch Set: Created 7 years 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
OLDNEW
(Empty)
1 import 'dart:convert';
2 import 'package:http/http.dart' as http;
3
4 void main() {
5 var url = 'https://api.github.com/users/dart-lang/repos';
6 http.get(url, headers : {'User-Agent': 'request'}).then((response) {
Søren Gjesse 2013/12/09 08:30:47 Shouldn't we put something like 'Dart/1.0 (My Dart
shailentuli 2013/12/11 04:07:52 Done.
7 var repos = JSON.decode(response.body);
8 for (var repo in repos) {
9 print("${repo['name']}, "
Søren Gjesse 2013/12/09 08:30:47 Maybe add some label text as well, e.g. "Repositor
shailentuli 2013/12/11 04:07:52 Added a little header explaining the categories.
10 "${repo['stargazers_count']} "
11 "${repo['forks_count']}");
12 }
13 });
14 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698