blob: 2a1558e161d2fccfcb14eaded753c97a0ef652e8 [file] [log] [blame]
// (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
import "dart:async";
import "dart:isolate";
import "dart:io";
import "package:expect/expect.dart";
// Test that a response line without any reason phrase is handled.
void missingReasonPhrase(int statusCode, bool includeSpace) {
var client = new HttpClient();
ServerSocket.bind("", 0).then((server) {
server.listen((client) {
if (includeSpace) {
client.write("HTTP/1.1 $statusCode \r\n\r\n");
} else {
client.write("HTTP/1.1 $statusCode\r\n\r\n");
.then((request) => request.close())
.then((response) {
Expect.equals(statusCode, response.statusCode);
Expect.equals("", response.reasonPhrase);
return response.drain();
}).whenComplete(() => server.close());
void main() {
missingReasonPhrase(HttpStatus.ok, true);
missingReasonPhrase(HttpStatus.internalServerError, true);
missingReasonPhrase(HttpStatus.ok, false);
missingReasonPhrase(HttpStatus.internalServerError, false);