| 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 http_test; | 5 library http_test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import '../lib/http.dart' as http; | 10 import '../lib/http.dart' as http; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 }, fields: { | 51 }, fields: { |
| 52 'some-field': 'value', | 52 'some-field': 'value', |
| 53 'other-field': 'other value' | 53 'other-field': 'other value' |
| 54 }).then((response) { | 54 }).then((response) { |
| 55 expect(response.statusCode, equals(200)); | 55 expect(response.statusCode, equals(200)); |
| 56 expect(response.body, parse(equals({ | 56 expect(response.body, parse(equals({ |
| 57 'method': 'POST', | 57 'method': 'POST', |
| 58 'path': '/', | 58 'path': '/', |
| 59 'headers': { | 59 'headers': { |
| 60 'content-type': [ | 60 'content-type': [ |
| 61 'application/x-www-form-urlencoded; charset=UTF-8' | 61 'application/x-www-form-urlencoded; charset=utf-8' |
| 62 ], | 62 ], |
| 63 'content-length': ['40'], | 63 'content-length': ['40'], |
| 64 'x-random-header': ['Value'], | 64 'x-random-header': ['Value'], |
| 65 'x-other-header': ['Other Value'] | 65 'x-other-header': ['Other Value'] |
| 66 }, | 66 }, |
| 67 'body': 'some-field=value&other-field=other+value' | 67 'body': 'some-field=value&other-field=other+value' |
| 68 }))); | 68 }))); |
| 69 }), completes); | 69 }), completes); |
| 70 }), completes); | 70 }), completes); |
| 71 }); | 71 }); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 100 }, fields: { | 100 }, fields: { |
| 101 'some-field': 'value', | 101 'some-field': 'value', |
| 102 'other-field': 'other value' | 102 'other-field': 'other value' |
| 103 }).then((response) { | 103 }).then((response) { |
| 104 expect(response.statusCode, equals(200)); | 104 expect(response.statusCode, equals(200)); |
| 105 expect(response.body, parse(equals({ | 105 expect(response.body, parse(equals({ |
| 106 'method': 'PUT', | 106 'method': 'PUT', |
| 107 'path': '/', | 107 'path': '/', |
| 108 'headers': { | 108 'headers': { |
| 109 'content-type': [ | 109 'content-type': [ |
| 110 'application/x-www-form-urlencoded; charset=UTF-8' | 110 'application/x-www-form-urlencoded; charset=utf-8' |
| 111 ], | 111 ], |
| 112 'content-length': ['40'], | 112 'content-length': ['40'], |
| 113 'x-random-header': ['Value'], | 113 'x-random-header': ['Value'], |
| 114 'x-other-header': ['Other Value'] | 114 'x-other-header': ['Other Value'] |
| 115 }, | 115 }, |
| 116 'body': 'some-field=value&other-field=other+value' | 116 'body': 'some-field=value&other-field=other+value' |
| 117 }))); | 117 }))); |
| 118 }), completes); | 118 }), completes); |
| 119 }), completes); | 119 }), completes); |
| 120 }); | 120 }); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 }), completes); | 203 }), completes); |
| 204 }); | 204 }); |
| 205 | 205 |
| 206 test('readBytes throws an error for a 4** status code', () { | 206 test('readBytes throws an error for a 4** status code', () { |
| 207 expect(startServer().then((_) { | 207 expect(startServer().then((_) { |
| 208 expect(http.readBytes(serverUrl.resolve('/error')), throwsHttpException)
; | 208 expect(http.readBytes(serverUrl.resolve('/error')), throwsHttpException)
; |
| 209 }), completes); | 209 }), completes); |
| 210 }); | 210 }); |
| 211 }); | 211 }); |
| 212 } | 212 } |
| OLD | NEW |