Chromium Code Reviews| Index: remoting/webapp/crd/js/host_controller.js |
| diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js |
| index 3dd8c93558c8d489aa53b8cb9fe2a97724bbc848..7a086fcc243b2f24845f2b94450bfd45bea810e8 100644 |
| --- a/remoting/webapp/crd/js/host_controller.js |
| +++ b/remoting/webapp/crd/js/host_controller.js |
| @@ -273,11 +273,6 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone, |
| */ |
| function doRegisterHost( |
| hostName, privateKey, publicKey, hostClientId, oauthToken) { |
| - var headers = { |
| - 'Authorization': 'OAuth ' + oauthToken, |
| - 'Content-type' : 'application/json; charset=UTF-8' |
| - }; |
| - |
| var newHostDetails = { data: { |
| hostId: newHostId, |
| hostName: hostName, |
| @@ -287,16 +282,16 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone, |
| var registerHostUrl = |
| remoting.settings.DIRECTORY_API_BASE_URL + '/@me/hosts'; |
| - if (hostClientId) { |
|
Jamie
2015/02/21 01:35:48
You've deleted this conditional. Was that intentio
John Williams
2015/02/23 23:00:55
Yes. The new version automagically omits URL param
|
| - registerHostUrl += '?' + remoting.xhr.urlencodeParamHash( |
| - { hostClientId: hostClientId }); |
| - } |
| - |
| - remoting.xhr.post( |
| - registerHostUrl, |
| - onRegistered.bind(null, hostName, publicKey, privateKey), |
| - JSON.stringify(newHostDetails), |
| - headers); |
| + remoting.xhr.start({ |
| + method: 'POST', |
| + url: remoting.settings.DIRECTORY_API_BASE_URL + '/@me/hosts', |
| + urlParams: { |
| + hostClientId: hostClientId |
| + }, |
| + onDone: onRegistered.bind(null, hostName, publicKey, privateKey), |
| + jsonContent: newHostDetails, |
| + oauthToken: oauthToken |
| + }); |
| } |
| /** |