Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
Pass a Uri to package:http APIs (#25)
Browse files Browse the repository at this point in the history
Prepare for dart-lang/http#375
  • Loading branch information
natebosch authored Dec 9, 2020
1 parent 8050a55 commit abae695
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/web_socket_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ void main() {
});

group('with a set of allowed origins', () {
var server;
var url;
HttpServer server;
Uri url;
setUp(() async {
server = await shelf_io.serve(
webSocketHandler((webSocket) {
webSocket.sink.close();
}, allowedOrigins: ['pub.dartlang.org', 'GoOgLe.CoM']),
'localhost',
0);
url = 'http://localhost:${server.port}/';
url = Uri.http('localhost:${server.port}', '');
});

tearDown(() => server.close());
Expand Down Expand Up @@ -117,21 +117,21 @@ void main() {
webSocket.sink.close();
}), 'localhost', 0);

var url = 'http://localhost:${server.port}/';
var url = Uri.http('localhost:${server.port}', '');
var headers = _handshakeHeaders;
headers['Connection'] = 'Other-Token, Upgrade';
expect(http.get(url, headers: headers).whenComplete(server.close),
hasStatus(101));
});

group('HTTP errors', () {
var server;
var url;
HttpServer server;
Uri url;
setUp(() async {
server = await shelf_io.serve(webSocketHandler((_) {
fail('should not create a WebSocket');
}), 'localhost', 0);
url = 'http://localhost:${server.port}/';
url = Uri.http('localhost:${server.port}', '');
});

tearDown(() => server.close());
Expand Down

0 comments on commit abae695

Please sign in to comment.