Bug 744614 - Make token server client conform with spec change; r=rnewman
authorGregory Szorc <gps@mozilla.com>
Wed, 11 Apr 2012 15:24:21 -0700
changeset 94806 54f5a1ebcf4315b23defb6bf3d6e914e971e21a5
parent 94805 b774546790d72c97debc66afc69ebd9f8a6bcfa9
child 94807 e72c21511787eed9b1523d832012a21b72bd58e2
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs744614
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 744614 - Make token server client conform with spec change; r=rnewman
services/common/tests/unit/test_tokenserverclient.js
services/common/tokenserverclient.js
--- a/services/common/tests/unit/test_tokenserverclient.js
+++ b/services/common/tests/unit/test_tokenserverclient.js
@@ -20,17 +20,17 @@ add_test(function test_working_bid_excha
       do_check_true(request.hasHeader("accept"));
       do_check_eq("application/json", request.getHeader("accept"));
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json");
 
       let body = JSON.stringify({
         id:           "id",
-        secret:       "key",
+        key:          "key",
         api_endpoint: service,
         uid:          "uid",
       });
       response.bodyOutputStream.write(body, body.length);
     }
   });
 
   let client = new TokenServerClient();
@@ -143,17 +143,17 @@ add_test(function test_rich_media_types(
 
   let server = httpd_setup({
     "/foo": function(request, response) {
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json; foo=bar; bar=foo");
 
       let body = JSON.stringify({
         id:           "id",
-        secret:       "key",
+        key:          "key",
         api_endpoint: "foo",
         uid:          "uid",
       });
       response.bodyOutputStream.write(body, body.length);
     }
   });
 
   let url = TEST_SERVER_URL + "foo";
--- a/services/common/tokenserverclient.js
+++ b/services/common/tokenserverclient.js
@@ -211,28 +211,28 @@ TokenServerClient.prototype = {
     } catch (ex) {
       let error = new TokenServerClientServerError("Invalid JSON returned " +
                                                    "from server.");
       error.response = response;
       cb(error, null);
       return;
     }
 
-    for each (let k in ["id", "secret", "api_endpoint", "uid"]) {
+    for each (let k in ["id", "key", "api_endpoint", "uid"]) {
       if (!(k in result)) {
         let error = new TokenServerClientServerError("Expected key not " +
                                                      " present in result: " +
                                                      k);
         error.response = response;
         cb(error, null);
         return;
       }
     }
 
     this._log.debug("Successful token response: " + result.id);
     cb(null, {
       id:       result.id,
-      key:      result.secret,
+      key:      result.key,
       endpoint: result.api_endpoint,
       uid:      result.uid,
     });
   }
 };