| OLD | NEW | 
|   1 // Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file |   1 // Copyright (c) 2013, 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 client_test; |   5 library client_test; | 
|   6  |   6  | 
|   7 import 'dart:io'; |   7 import 'dart:io'; | 
|   8 import 'dart:uri'; |   8 import 'dart:uri'; | 
|   9  |   9  | 
|  10 import 'package:unittest/unittest.dart'; |  10 import 'package:unittest/unittest.dart'; | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
|  34       }).whenComplete(client.close), completion(parse(equals({ |  34       }).whenComplete(client.close), completion(parse(equals({ | 
|  35         'method': 'POST', |  35         'method': 'POST', | 
|  36         'path': '/', |  36         'path': '/', | 
|  37         'headers': { |  37         'headers': { | 
|  38           'content-type': ['application/json; charset=utf-8'], |  38           'content-type': ['application/json; charset=utf-8'], | 
|  39           'transfer-encoding': ['chunked'] |  39           'transfer-encoding': ['chunked'] | 
|  40         }, |  40         }, | 
|  41         'body': '{"hello": "world"}' |  41         'body': '{"hello": "world"}' | 
|  42       })))); |  42       })))); | 
|  43  |  43  | 
|  44       request.sink.add('{"hello": "world"}'.charCodes); |  44       request.sink.add('{"hello": "world"}'.codeUnits); | 
|  45       request.sink.close(); |  45       request.sink.close(); | 
|  46     }), completes); |  46     }), completes); | 
|  47   }); |  47   }); | 
|  48  |  48  | 
|  49   test('#send with an invalid URL', () { |  49   test('#send with an invalid URL', () { | 
|  50     expect(startServer().then((_) { |  50     expect(startServer().then((_) { | 
|  51       var client = new http.Client(); |  51       var client = new http.Client(); | 
|  52       var url = Uri.parse('http://http.invalid'); |  52       var url = Uri.parse('http://http.invalid'); | 
|  53       var request = new http.StreamedRequest("POST", url); |  53       var request = new http.StreamedRequest("POST", url); | 
|  54       request.headers[HttpHeaders.CONTENT_TYPE] = |  54       request.headers[HttpHeaders.CONTENT_TYPE] = | 
|  55           'application/json; charset=utf-8'; |  55           'application/json; charset=utf-8'; | 
|  56  |  56  | 
|  57       expect(client.send(request), throwsSocketIOException); |  57       expect(client.send(request), throwsSocketIOException); | 
|  58  |  58  | 
|  59       request.sink.add('{"hello": "world"}'.charCodes); |  59       request.sink.add('{"hello": "world"}'.codeUnits); | 
|  60       request.sink.close(); |  60       request.sink.close(); | 
|  61     }), completes); |  61     }), completes); | 
|  62   }); |  62   }); | 
|  63 } |  63 } | 
| OLD | NEW |