Skip to content

Commit

Permalink
No HTTP version
Browse files Browse the repository at this point in the history
  • Loading branch information
brianquinlan committed Sep 13, 2023
1 parent da5340e commit 8a833aa
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ void testResponseStatusLine(Client client) async {
test(
'without HTTP version',
() async {
httpServerChannel.sink.add('200 OK');
await expectLater(
client.get(Uri.http(host, '')),
throwsA(isA<ClientException>()),
);
httpServerChannel.sink.add('201 Created');
try {
final response = await client.get(Uri.http(host, ''));
expect(response.statusCode, 201);
expect(response.reasonPhrase, 'Created');
} on ClientException {
// A Http-Version is required according to RFC-2616
}
},
);

Expand All @@ -51,6 +54,7 @@ void testResponseStatusLine(Client client) async {
httpServerChannel.sink.add('HTTP/1.1 201');
try {
final response = await client.get(Uri.http(host, ''));
expect(response.statusCode, 201);
// All of these responses seem reasonable.
expect(response.reasonPhrase, anyOf(isNull, '', 'Created'));
} on ClientException {
Expand Down

0 comments on commit 8a833aa

Please sign in to comment.