Question

I'm using node.js and nodefilx to try this out. It's a very simple query:

var nodeflix = require('nodeflix');

var n = new nodeflix({
    consumer_key:       'MY_KEY',
    consumer_secret:    'MY_SECRET',
    oauth_token:        '',     // optional, for signed user requests
    oauth_token_secret: '',     // optional, for signed user requests
    user_id:            ''      // optional, for signed user requests
});

// lookup something from the people catalog
n.get('/catalog/titles/streaming',function(data) {
    console.log(data);
});

I have a valid dev keys, and the query to /catalog/titles (with proper parameters) returns results. It's very strange because I get "" as a response, not any kind of error. I've also tried modifying nodefilx and adding "Accept-Encoding : gzip" to the header but the gzip'd response is still empty.

When I try this manually in chrome, I do get a response. Is there something else in the headers that I need to add?

Était-ce utile?

La solution

In case of the (unlikely) event that someone else has this problem, turns out I wasn't looking at the response properly. It's returning:

response.statusCode === 307

which is a re-direct to another URL. I had to extend nodeflix to include the response on the callback so I could handle this and issue another request.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top