Merge pull request #7 from bcko/patch-1
Update .gitignore to new `dart_tool` pub cache
diff --git a/.travis.yml b/.travis.yml
index dc8b4f9..37497c0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,16 +3,11 @@
dart:
- dev
dart_task:
+ # TODO: Only run dartfmt and dartanalyzer over dev release once Dart 2 stable is out
+ - dartfmt
+ - dartanalyzer
- test
-matrix:
- include:
- # Only validate formatting using the dev release
- - dart: dev
- dart_task: dartfmt
- - dart: dev
- dart_task: analyzer
-
# Only building master means that we don't run two builds for each pull request.
branches:
only: [master]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a6d8a92..3397968 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,23 @@
+## 0.2.2+5
+
+* Allow `stream_channel` version 2.x
+
+## 0.2.2+4
+
+* Fix the check for `onConnection` to check the number of arguments and not
+ that the arguments are `dynamic`.
+
+## 0.2.2+3
+
+* Set max SDK version to `<3.0.0`, and adjust other dependencies.
+
+## 0.2.2+2
+
+* Stopped using deprected `HTML_ESCAPE` constant name.
+
## 0.2.2+1
-* Updated SDK version to 2.0.0-dev.17.0
+* Update SDK version to 2.0.0-dev.17.0.
## 0.2.2
diff --git a/README.md b/README.md
index aa9379e..5723571 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
void main() {
var handler = webSocketHandler((webSocket) {
- webSocket.listen((message) {
+ webSocket.stream.listen((message) {
webSocket.add("echo $message");
});
});
diff --git a/analysis_options.yaml b/analysis_options.yaml
deleted file mode 100644
index 350c2d4..0000000
--- a/analysis_options.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-analyzer:
- strong-mode: true
diff --git a/lib/shelf_web_socket.dart b/lib/shelf_web_socket.dart
index 9c9239d..bdfa187 100644
--- a/lib/shelf_web_socket.dart
+++ b/lib/shelf_web_socket.dart
@@ -7,8 +7,7 @@
import 'src/web_socket_handler.dart';
-/// A typedef used to determine if a function takes two arguments or not.
-typedef _BinaryFunction(arg1, arg2);
+typedef _BinaryFunction = void Function(Null, Null);
/// Creates a Shelf handler that upgrades HTTP requests to WebSocket
/// connections.
diff --git a/lib/src/web_socket_handler.dart b/lib/src/web_socket_handler.dart
index e5d4bed..f1acc9f 100644
--- a/lib/src/web_socket_handler.dart
+++ b/lib/src/web_socket_handler.dart
@@ -117,8 +117,8 @@
///
/// [title] and [message] will be automatically HTML-escaped.
Response _htmlResponse(int statusCode, String title, String message) {
- title = HTML_ESCAPE.convert(title);
- message = HTML_ESCAPE.convert(message);
+ title = htmlEscape.convert(title);
+ message = htmlEscape.convert(message);
return new Response(statusCode, body: """
<!doctype html>
<html>
diff --git a/pubspec.yaml b/pubspec.yaml
index 3b80906..310bb84 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,15 +1,19 @@
name: shelf_web_socket
-version: 0.2.2+1
-author: "Dart Team <misc@dartlang.org>"
-homepage: http://github.com/dart-lang/shelf_web_socket
-description: >
- A WebSocket handler for Shelf.
+version: 0.2.2+5
+
+description: >-
+ A shelf handler that wires up a listener for every connection.
+author: Dart Team <misc@dartlang.org>
+homepage: https://github.com/dart-lang/shelf_web_socket
+
+environment:
+ sdk: ">=2.0.0 <3.0.0"
+
dependencies:
- shelf: ">=0.7.0 <0.8.0"
- stream_channel: "^1.4.0"
- web_socket_channel: "^1.0.0"
+ shelf: ^0.7.0
+ web_socket_channel: ^1.0.0
+ stream_channel: ">1.4.0 <3.0.0"
+
dev_dependencies:
http: ">=0.10.0 <0.12.0"
- test: "^0.12.0"
-environment:
- sdk: ">=2.0.0-dev.17.0 <2.0.0"
+ test: ^1.0.0
diff --git a/test/web_socket_test.dart b/test/web_socket_test.dart
index 6b83d94..43abce1 100644
--- a/test/web_socket_test.dart
+++ b/test/web_socket_test.dart
@@ -178,7 +178,7 @@
}
Matcher hasStatus(int status) => completion(predicate((response) {
- expect(response, new isInstanceOf<http.Response>());
+ expect(response, new TypeMatcher<http.Response>());
expect(response.statusCode, equals(status));
return true;
}));