| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 shelf_proxy; | |
| 6 | |
| 7 import 'dart:async'; | 5 import 'dart:async'; |
| 8 | 6 |
| 9 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
| 10 import 'package:http/testing.dart'; | 8 import 'package:http/testing.dart'; |
| 11 import 'package:scheduled_test/scheduled_test.dart'; | 9 import 'package:scheduled_test/scheduled_test.dart'; |
| 12 import 'package:shelf/shelf.dart' as shelf; | 10 import 'package:shelf/shelf.dart' as shelf; |
| 13 import 'package:shelf/shelf_io.dart' as shelf_io; | 11 import 'package:shelf/shelf_io.dart' as shelf_io; |
| 14 import 'package:shelf_proxy/shelf_proxy.dart'; | 12 import 'package:shelf_proxy/shelf_proxy.dart'; |
| 15 | 13 |
| 16 /// The URI of the server the current proxy server is proxying to. | 14 /// The URI of the server the current proxy server is proxying to. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 /// Schedules a GET request with [headers] to the proxy server. | 248 /// Schedules a GET request with [headers] to the proxy server. |
| 251 Future<http.Response> get({Map<String, String> headers}) { | 249 Future<http.Response> get({Map<String, String> headers}) { |
| 252 return schedule(() { | 250 return schedule(() { |
| 253 var uri = proxyUri; | 251 var uri = proxyUri; |
| 254 var request = new http.Request('GET', uri); | 252 var request = new http.Request('GET', uri); |
| 255 if (headers != null) request.headers.addAll(headers); | 253 if (headers != null) request.headers.addAll(headers); |
| 256 request.followRedirects = false; | 254 request.followRedirects = false; |
| 257 return request.send().then(http.Response.fromStream); | 255 return request.send().then(http.Response.fromStream); |
| 258 }, 'GET proxy server'); | 256 }, 'GET proxy server'); |
| 259 } | 257 } |
| OLD | NEW |