Vimeo-api响应身体空虚

时间:2014-10-16 08:14:59

标签: node.js vimeo-api

我在这里使用vimeo-api for node.js https://github.com/vimeo/vimeo.js
我想做简单的视频搜索请求,但是在遵循示例并做一切几乎相同的事情时,我偶然发现了一些问题

代码:

, Vimeo = require('vimeo-api').Vimeo;

var lib = new Vimeo(*myapp id*, *my app secret*);

lib.generateClientCredentials('public', function (err, access_token) {

if (err) {
    throw err;
}
console.log('credentials generated')

var token = access_token.access_token;
console.log(token);
lib.access_token = *token, generated in my app authentication tab on vimeo developer()*;
    var scopes = access_token.scope;
console.log(scopes);
});

client.on('vimeocall', function (qinput) {
      console.log('got vimeo call');
      lib.request(/*options*/{
      // This is the path for the videos contained within the staff picks channels
      path: '/videos',
      // This adds the parameters to request page two, and 10 items per page
      query: {
          query: qinput,              
          per_page: 10
      }
  }, /*callback*/function (error, body, status_code, headers) {
      if (error) {
          console.log('error');
          console.log(error);
      } else {
          console.log('body');
          console.log(body);              
      }

      console.log('status code');
      console.log(status_code);
      console.log('headers');
      console.log(headers);
  });
})

所以,第一个问题是,控制台登录generateClientCredentials打印,tokenscopes未发现;
然后我手动放置预生成的令牌,进一步测试它 第二个问题 - 从lib.request日志status code 200headers回调数据,但是embty body - 只是正文{}。 在localhost上测试 哪里搞砸了?

更新 headers提示:

{ date: 'Thu, 16 Oct 2014 15:48:44 GMT',
server: 'Apache',
'set-cookie': [ 'vuid=1338193217.1277890698; expires=Sun, 13-Oct-2024 15:48:44
GMT; path=/; domain=.vimeo.com' ],
vary: 'Accept,Vimeo-Client-Id,Accept-Encoding',
'cache-control': 'no-cache, max-age=315360000',
expires: 'Sun, 13 Oct 2024 15:48:44 GMT',
'keep-alive': 'timeout=100, max=88',
connection: 'Keep-Alive',
'transfer-encoding': 'chunked',
'content-type': 'application/vnd.vimeo.video+json',
 via: '1.1 dca1-10' }

0 个答案:

没有答案