我正在关注这里的例子
http://mcavage.github.com/node-restify/#JsonClient
如下
var client = restify.createJsonClient({
url: 'http://api.stackoverflow.com'
});
client.get('/1.1/users/19068', function(err, req, res, obj) {
assert.ifError(err);
console.log('%j', obj);
});
我收到以下错误消息
SyntaxError: Unexpected token
at Object.parse (native)
at /.../node_modules/restify/lib/clients/json_client.js:54:20
at IncomingMessage.<anonymous> (/.../node_modules/restify/lib/clients/string_client.js:149:16)
at IncomingMessage.g (events.js:156:14)
at IncomingMessage.emit (events.js:88:20)
at HTTPParser.onMessageComplete (http.js:137:23)
at Socket.ondata (http.js:1147:24)
at TCP.onread (net.js:354:27)