Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: tests/standalone/io/http_no_reason_phrase_test.dart

Issue 169723003: Allow HTTP response without reason phrase (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // (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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // VMOptions=
6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write
9
10 import "package:expect/expect.dart";
11 import "dart:async";
12 import "dart:isolate";
13 import "dart:io";
14
15 // Test that a response line without any reason phrase is handled.
16 void missingReasonPhrase(int statusCode, bool includeSpace) {
17 var client = new HttpClient();
18 ServerSocket.bind("127.0.0.1", 0).then((server) {
19 server.listen((client) {
20 if (includeSpace) {
21 client.write("HTTP/1.1 $statusCode \r\n\r\n");
22 } else {
23 client.write("HTTP/1.1 $statusCode\r\n\r\n");
24 }
25 client.close();
26 });
27 client.getUrl(Uri.parse("http://127.0.0.1:${server.port}/"))
28 .then((request) => request.close())
29 .then((response) {
30 Expect.equals(statusCode, response.statusCode);
31 Expect.equals("", response.reasonPhrase);
32 })
33 .whenComplete(() => server.close());
34 });
35 }
36
37 void main() {
38 missingReasonPhrase(HttpStatus.OK, true);
39 missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, true);
40 missingReasonPhrase(HttpStatus.OK, false);
41 missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, false);
42 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698