Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from amiuhle/dart-update

Use proper types in the RouteEventList / Accept JSON responses.
  • Loading branch information...
commit ed20f321379c012f9630447e1133c70d00955f5f 2 parents 6f90a56 + ab4760b
Chris Strom authored
Showing with 9 additions and 6 deletions.
  1. +2 −2 HipsterRouter.dart
  2. +7 −4 HipsterSync.dart
View
4 HipsterRouter.dart
@@ -111,8 +111,8 @@ class RouterEventList implements EventListenerList {
listeners = [];
}
- RouterEventList add(fn) {
- listeners.add(fn);
+ RouterEventList add(EventListener handler, [bool useCapture]) {
+ listeners.add(handler);
return this;
}
View
11 HipsterSync.dart
@@ -43,14 +43,14 @@ class HipsterSync {
verb = _methodMap.containsKey(method) ?
_methodMap[method] : method;
- var request = new XMLHttpRequest(),
- completer = new Completer();
-
+ XMLHttpRequest request = new XMLHttpRequest();
+ Completer completer = new Completer();
+
request.
on.
load.
add((event) {
- var req = event.target;
+ XMLHttpRequest req = event.target;
if (req.status > 299) {
completer.
@@ -64,6 +64,9 @@ class HipsterSync {
request.open(verb, model.url, true);
+ // Tell the server that we expect JSON!
+ request.setRequestHeader("Accept", "application/json");
+
// POST and PUT HTTP request bodies if necessary
if (verb == 'post' || verb == 'put') {
request.setRequestHeader('Content-type', 'application/json');

0 comments on commit ed20f32

Please sign in to comment.
Something went wrong with that request. Please try again.