Thursday, 8 June 2017

error with nodejs PUT request

I am getting an error with atttempting the following PUT request with nodejs.

var request = require('request');
request('http://1xx.xxx.xxx.xxx:8080/maintable/http%3A%2F%2Ftesturl.com
  %2F', 
method: 'PUT', 
json:{"Row":[{"key":"aHR0cHM6Ly9tYWt6ZW9uLndvcmRwcmVzcy5jb20v", "Cell": 
 [{"column":"YmxvZ3NfZGF0YTp1cmw=", "$":    
 "aHR0cHM6Ly9tYWt6ZW9uLndvcmRwcmVzcy5jb20v"},
 {"column":"YmxvZ3NfZGF0YTppbnNlcnREYXRl", "$": "MTQ5Njg3ODk1OA=="},    
 {"column":"YmxvZ3NfZGF0YTpzdGF0dXM=", "$": "QWN0aXZl"}], 
}]}, 
function (error, response, body) {
    console.log('error:', error);
    console.log('statusCode:', response && response.statusCode);
    console.log('body:', body);
}
);

ERROR:

 method: 'PUT',
    ^^^^^^
 SyntaxError: missing ) after argument list
 at createScript (vm.js:56:10)
 at Object.runInThisContext (vm.js:97:10)
 at Module._compile (module.js:542:28)
 at Object.Module._extensions..js (module.js:579:10)
 at Module.load (module.js:487:32)
 at tryModuleLoad (module.js:446:12)
 at Function.Module._load (module.js:438:3)
  at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)

Does anyone notice where the error is?



via vbNewbie

No comments:

Post a Comment