Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library testing; | |
| 6 | |
| 7 /// This library contains testing classes for the HTTP library. | |
| 8 /// | |
| 9 /// The [MockClient] class is a drop-in replacement for `http.Client` that | |
| 10 /// allows test code to set up a local request handler in order to fake a server | |
| 11 /// that responds to HTTP requests: | |
| 12 /// | |
| 13 /// import 'dart:json'; | |
| 14 /// import 'package:http/testing.dart'; | |
| 15 /// | |
| 16 /// var client = new MockClient((request) { | |
| 17 /// if (request.url.path != "/data.json") { | |
| 18 /// return new Response("", 404); | |
| 19 /// } | |
| 20 /// return new Response(JSON.stringify({ | |
| 21 /// 'numbers': [1, 4, 15, 19, 214] | |
| 22 /// }, 200, headers: { | |
| 23 /// 'content-type': 'application/json' | |
| 24 /// }); | |
| 25 /// }; | |
| 26 | |
| 27 export 'src/mock_client.dart'; | |
|
Bob Nystrom
2012/11/05 23:25:15
Is there any reason you're leaving the source ther
nweiz
2012/11/05 23:40:15
It indicates that this library isn't intended to j
| |
| OLD | NEW |