@@ -5,7 +5,7 @@ part of taskqueue_v1beta1_api_browser;
55 */
66abstract class BrowserClient extends Client {
77
8- oauth.OAuth2 _auth;
8+ final oauth.OAuth2 _auth;
99 core.bool _jsClientLoaded = false ;
1010
1111 BrowserClient ([oauth.OAuth2 this ._auth]) : super ();
@@ -15,27 +15,27 @@ abstract class BrowserClient extends Client {
1515 */
1616 async .Future <core.bool > _loadJsClient () {
1717 var completer = new async .Completer ();
18-
18+
1919 if (_jsClientLoaded) {
2020 completer.complete (true );
2121 return completer.future;
2222 }
23-
23+
2424 js.scoped ((){
2525 js.context.handleClientLoad = new js.Callback .once (() {
2626 _jsClientLoaded = true ;
2727 completer.complete (true );
2828 });
2929 });
30-
30+
3131 html.ScriptElement script = new html.ScriptElement ();
3232 script.src = "http://apis.google.com/js/client.js?onload=handleClientLoad" ;
3333 script.type = "text/javascript" ;
3434 html.document.body.children.add (script);
35-
35+
3636 return completer.future;
3737 }
38-
38+
3939 /**
4040 * Makes a request via the JS Client Library to circumvent CORS-problems
4141 */
@@ -45,19 +45,19 @@ abstract class BrowserClient extends Client {
4545 requestData["path" ] = requestUrl;
4646 requestData["method" ] = method;
4747 requestData["headers" ] = new core.Map ();
48-
48+
4949 if (queryParams != null ) {
5050 requestData["params" ] = queryParams;
5151 }
52-
52+
5353 if (body != null ) {
5454 requestData["body" ] = body;
5555 requestData["headers" ]["Content-Type" ] = contentType;
5656 }
5757 if (makeAuthRequests && _auth != null && _auth.token != null ) {
5858 requestData["headers" ]["Authorization" ] = "${_auth .token .type } ${_auth .token .data }" ;
5959 }
60-
60+
6161 js.scoped (() {
6262 var request = js.context.gapi.client.request (js.map (requestData));
6363 var callback = new js.Callback .once ((jsonResp, rawResp) {
@@ -66,15 +66,15 @@ abstract class BrowserClient extends Client {
6666 if (raw["gapiRequest" ]["data" ]["status" ] >= 400 ) {
6767 completer.completeError (new APIRequestException ("JS Client - ${raw ["gapiRequest" ]["data" ]["status" ]} ${raw ["gapiRequest" ]["data" ]["statusText" ]} - ${raw ["gapiRequest" ]["data" ]["body" ]}" ));
6868 } else {
69- completer.complete ({});
69+ completer.complete ({});
7070 }
7171 } else {
7272 completer.complete (js.context.JSON .stringify (jsonResp));
7373 }
7474 });
7575 request.execute (callback);
7676 });
77-
77+
7878 return completer.future;
7979 }
8080
@@ -133,7 +133,7 @@ abstract class BrowserClient extends Client {
133133 if (request.responseText != null ) {
134134 var errorJson;
135135 try {
136- errorJson = JSON .parse (request.responseText);
136+ errorJson = JSON .parse (request.responseText);
137137 } on core.FormatException {
138138 errorJson = null ;
139139 }
0 commit comments