OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 XHRTest; | 5 library XHRTest; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
10 import 'package:unittest/html_individual_config.dart'; | 10 import 'package:unittest/html_individual_config.dart'; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 var json = xhr.response; | 241 var json = xhr.response; |
242 expect(json, equals(data)); | 242 expect(json, equals(data)); |
243 })); | 243 })); |
244 }); | 244 }); |
245 }); | 245 }); |
246 | 246 |
247 group('headers', () { | 247 group('headers', () { |
248 test('xhr responseHeaders', () { | 248 test('xhr responseHeaders', () { |
249 return HttpRequest.request(url).then( | 249 return HttpRequest.request(url).then( |
250 (xhr) { | 250 (xhr) { |
251 var serverHeader = xhr.responseHeaders['server']; | 251 var contentTypeHeader = xhr.responseHeaders['content-type']; |
252 expect(serverHeader, isNotNull); | 252 expect(contentTypeHeader, isNotNull); |
253 // Should be like: 'Dart/0.1 (dart:io)' | 253 // Should be like: 'text/plain; charset=utf-8' |
254 expect(serverHeader.startsWith('Dart/'), isTrue); | 254 expect(contentTypeHeader.contains('text/plain'), isTrue); |
| 255 expect(contentTypeHeader.contains('charset=utf-8'), isTrue); |
255 }); | 256 }); |
256 }); | 257 }); |
257 }); | 258 }); |
258 } | 259 } |
OLD | NEW |